why including www in a jquery load causes it to fail?
Could someone enlighten me as to why including www in a ajax request causes it to fail.
i.e. This works:
$('#mydiv').load('http://mydomain.com/getitems');
But this doesn't (returns nothing)
$('#开发者_运维问答mydiv').load('http://www.mydomain.com/getitems');
Note that www.mydomain.com/getitems is a valid domain, in the sense that if I point my web browser to it I am able to load the page.
Are you calling the script from mydomain.com or from www.mydomain.com or from otherdomain.com ?
May be you are trying to do some kind of cross site scripting with out knowing it .
AJAX considers www.mydomain.com and mydomain.com to be different domains. AJAX has cross domain restrictions for security reasons. If you absolutely need to do this there are ways to do cross domain AJAX querying with jQuery.
精彩评论