简体   繁体   中英

Update HTML content after a webpage has been loaded without reload

I'm using php and jquery and trying to get a notification to appear after a user submits a form. I'm using ajax for the form submission so that the page does not reload. I want the notification to contain some of the information from the form so they know if it has been entered already. The notification is just a hidden div that is shown when the ajax data is sent. Is there any PHP statements or something in javascript or JQuery that can do this?

Use ajax like this:

ajaxCall("formHandler.php", yourForm);

function ajaxCall(url, postData){

$.ajax(url, {
        dataType: "json",
        method: "post",
        data: {postData}
        success: function(data) {

        // your Code, example:
           document.getElementById("yourDIV").style.display="block";

    });
return true;
}

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