$.get, $.post, $.ajax, $(elm).load to .ashx page problem

混江龙づ霸主 提交于 2019-12-06 05:57:40

Well, the reason your $.ajax() doesn't work is because it's syntactically invalid. It should look more like this:

$.ajax({
    type: "POST", // or "GET"
    url: "list.ashx",
    data: "postvar=whatever",
    success: function(r3){
       alert("ajax: " + r3);
    }
});

Also, when using $.get and $.post, you should put the data in the second parameter:

$.get(url, 'getvar=whatever', function (r1) { alert("get: " + r1); });
$.post(url, 'postvar=whatever', function (r2) { alert("post: " + r2); });

// or use a map

$.get(url, { getvar : 'whatever' }, function (r1) { alert("get: " + r1); });
$.post(url, { postvar : 'whatever' }, function (r2) { alert("post: " + r2); });
karim79

Since you are firing off four asynchronous requests in one go to the same page, this might be relevant:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!