开发者

how to make an ajax request after sending data by post?

i meet a problem, when try to make an ajax request after sending data by post.

let's assume i have a index.php file. In the form i send data by post to the same file, and after posting i want to make ajax request, but it don't doesn't happen, because it "wants" to ask about resen开发者_StackOverflow社区ding data, but it doesn't show in popup window.

So, how can i disable the question about resending data, to be possible to make an ajax request?

Thanks


That would not happen . Once you are posting data you are actually reloading your entire page . If you want to do an AJAX call after the post , you should consider making the post request as ajax as well .

So currently if what you are doing is :
Step 1 : Post data to index.php
Step 2 : Make AJAX call

you should consider restructuring it to :
Step 1: Make a XHR call to post data
Step 2 : Make another XHR call .

Another way to do this is that in the Page returned after the post request , you can set a cliest side js variable , and the on document load , you can fire the AJAX request , however I dont think that is what you are looking for .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜