简体   繁体   中英

How to update a Div in your page from a JQuery Ui dialog?

How can I update my page from a JQuery UI dialog? this is is my code so far and is not working. Any help would be much appreciated.

function submit_new_site() {

    //these are the input text id's on the dialog 
    address = $('#loc_address').val();
    city = $('#loc_city').val();
    county = $('#loc_county').val();
    state = $('#loc_state').val();
    zip = $('#loc_zip').val();
    notes = $('#loc_notes').val();

    //and these are the div's on the page that calls the jQuery UI dialog
    $('#new_site').html(address);
    $('#new_site_city').html(city);
    $('#new_site_county').html(county);
    $('#new_site_state').html(state);
    $('#new_site_zip').html(zip);

    //this function is called from a button on the jQuery UI dialog
    //but is not updating the page with the user entered information.       

}

try $('#loc_address').prop('value') instead. val() no longer always reports the current value, IIRC.

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