How to receive post with ajax


Send post to test.php in the same hierarchy and accept the result in html variable

$.ajax(
{
type: "POST",
url: "test.php",
data: {'test': test, 'name': 0, 'asdf': 'asdf'},

success: function(html)
{
alert(html);
}
});

In the php of the recipient, specify it as follows

<?php 
echo "come here";
echo $_POST['test'];
?>

The directory structure looks something like this

$ tree
.
├── a.php
└── test.php
藤沢瞭介(Ryosuke Hujisawa)
  • りょすけと申します。18歳からプログラミングをはじめ、今はフロントエンドでReactを書いたり、AIの勉強を頑張っています。off.tokyoでは、ハイテクやガジェット、それからプログラミングに関する情報まで、エンジニアに役立つ情報を日々発信しています!

未整理記事