简体   繁体   中英

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 resending 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM