2011-12-15 75 views
0

如何从JQuery UI对话框更新我的页面?这是我的代码到目前为止,并没有工作。任何帮助将非常感激。如何从JQuery Ui对话框更新页面中的Div?

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.  

} 
+3

请更多代码。这些行在哪里执行? – 2011-12-15 18:39:52

+0

看到jsFiddle上的代码会很有帮助。什么不工作? – 2011-12-15 18:40:46

回答

0

尝试$('#loc_address').prop('value')代替。 val()不再总是报告当前值,IIRC。