admin管理员组文章数量:1316834
i'm with a problem that i have to get the json from here:
.php?srv=home
there is an option too to add callback function name like:
.php?srv=home&callback=myFunction
that will return something like: myFunction({'msgd':'value'})
;
i want to make um ajax request using jQuery, is that possible? i still receiving error with the normal $.ajax request, i was told that i must use jsonp or cross site scripting... how it works? someone got an exemple? tnx!!
i'm with a problem that i have to get the json from here:
http://templodasdeusas..br/game/srv/game.php?srv=home
there is an option too to add callback function name like:
http://templodasdeusas..br/game/srv/game.php?srv=home&callback=myFunction
that will return something like: myFunction({'msgd':'value'})
;
i want to make um ajax request using jQuery, is that possible? i still receiving error with the normal $.ajax request, i was told that i must use jsonp or cross site scripting... how it works? someone got an exemple? tnx!!
Share Improve this question edited Jun 8, 2011 at 20:12 Pointy 414k62 gold badges594 silver badges627 bronze badges asked Jun 8, 2011 at 20:09 TiagoTiago 211 gold badge1 silver badge2 bronze badges2 Answers
Reset to default 5jQuery does this transparently for you, if you put callback=?
in the URL. See the API entry for $.getJSON
. You can basically forget about the cross-domain nature of the request.
So you might do something like this:
$.getJSON(
'http://templodasdeusas..br/game/srv/game.php?srv=home&callback=?',
function(data) {
// use the response, contained in the data object, e.g.
alert(data.msgd);
}
);
See this:
http://jquery-howto.blogspot./2009/04/cross-domain-ajax-querying-with-jquery.html
and this:
http://james.padolsey./javascript/cross-domain-requests-with-jquery/
本文标签: javascriptHow to make an ajax with JQuery with cross site scriptingStack Overflow
版权声明:本文标题:javascript - How to make an ajax with JQuery with cross site scripting? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742013847a2413396.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论