Example 1
Request B Web page, transfer 2 parameters, ignore the return value:
$.get ("A/b", {name: "John", Time: "2pm"});
Example 2
Displays the B return value (HTML or XML, depending on the return value):
$.get ("A/b", function (data) {alert ("Data Loaded:" + data);});
Example 3
Displays the B return value (HTML or XML, depending on the return value), adding a set of request parameters:
$.get ("A/b", {name: "John", Time: "2pm"}, function (data) {alert ("Data Loaded:" + data); });
<?php
Class Aaction extends commonaction{
Fucntion B () {
Echo 111111;
$list = Array (1=> ' a ',2=> ' B ');
echo Json_encode ($list);
}
}
?>
<script>
$.get ("A/b", function (data) {
var arr = eval (' (' + data + ') ');
for (Var i=0;i<arr.length;i++) {
alert (arr[i].id);
}
});
</script>
This article is from the "Record Little Knowledge" blog, please be sure to keep this source http://anbaojia.blog.51cto.com/9494280/1565163
jquery Ajax is sending data to PHP and accepting data