0

What is the best approach to have a form and a table in the same page, where the form has a submit button (ajaxsubmit) that saves the data in database and table should display the data without the need to refresh the page?

I have tried to call $.load to get the table, but some problems occurred due to the problem that $.load function finishes after document.ready

So shall i use iframe? or create an xml file and read the data into table?

4

2 回答 2

0

看看 jQuery 的 ajaxForm 和 ajaxSubmit 的解释:http ://www.justwebdevelopment.com/blog/ajaxform-and-ajaxsubmit-options/

于 2011-12-10T16:52:15.767 回答
0

要在方法完成后执行代码,$.load()您需要将其放在callbackload().

例如:

$("#myElement").load(
    '/location/of-target.html',
    function(data) {
        // put code here to execute after the load has completed.
        // for example to append a specific div.
        $(data).find("#myDiv").appendTo("#containerDiv");
    }
);

在这里进一步阅读

于 2011-12-10T16:58:17.237 回答