开发者

jQuery.get(' not getting file

开发者 https://www.devze.com 2023-02-02 21:27 出处:网络
Im trying jQuery.get(\'similar_products_stack.php\'); 开发者_如何学运维and jQuery.get(\'./similar_products_stack.php\');

Im trying

jQuery.get('similar_products_stack.php');

开发者_如何学运维and

jQuery.get('./similar_products_stack.php');

Where similar_products_stack.php returns an html array and I am getting error 404 that the file is not found even though both files are in the same directory.

what am I doing incorrectly?


Your .get call is fine, although it won't have much effect (since you're not doing anything once you've gotten the file). If you want to load it into somewhere on the DOM, you might look at .load.

If you're really getting a 404, that suggests that either you're mistaken that the files are in the same directory (more accurately, on the same path) on the server, or there's a permissions problem, redirects issue, etc. that prevents the server from accessing / running / returning results from the PHP file. All sorts of other symptoms might be more mysterious, but if the server is really reporting 404, it means that the resource cannot be found (or that the settings — e.g., permissions — don't allow the server to admit to finding it).


I suggest using absolute urls for ajax calls '/dir/similar_products_stack.php'

0

精彩评论

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