0

我尝试通过 ajax 发送一个简单的字符串,但 php GET var 为空。谢谢

function postJSON(){
$.ajax({
type: "GET",
url: "http://www.my-server.de/file.php",
data: { 'dataString': "juhu" },
cache: false,
success: function()
    {
        alert("Order Submitted");
    },
    error: function()
    {
        alert("Error");
    }
});

php:

 <?php 
 echo "Value is:";
 echo $_GET['dataString']; ?>
4

1 回答 1

2

也许你应该试试这个

$.ajax({
   type: "GET",
   url: "http://www.my-server.de/file.php",
   data: { 'dataString': "juhu" },
   cache: false,
   success: function( response ){
       alert( response );
   },
   error: function() {
       alert("Error");
   }
});
于 2013-07-18T13:10:51.150 回答