开发者

jquery ajax function

function decreased(param) {
   console.log(param);
     $.ajax({
 type: "GET",
 url: "scri开发者_Go百科pts/closed.php",
 data: "name=" + param,
 success: console.log('success'),
          });
    }

I don't know why my function isn't working. The path is correct the param is correct if i type in closed.php?name=param the script there works and in the end after calling the function i get the console log success printed, i really don't understand.


The problem is with your success handler. It should be like this:

$.ajax({
    type: "GET",
    url: "scripts/closed.php",
    data: { name: param },
    success: function(data) {
        console.log('success');
    }
});

Also notice the usage of a hash for the data parameter which allows to properly URL encode values.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜