admin管理员组

文章数量:1415420

Im trying to reload JUST a table on a page [Ajax it a bit confusing]

var table = document.getElementById ("table");
table.refresh();

Would that have the same results as using ajax to reload the table?

Im trying to reload JUST a table on a page [Ajax it a bit confusing]

var table = document.getElementById ("table");
table.refresh();

Would that have the same results as using ajax to reload the table?

Share Improve this question asked Jun 20, 2012 at 20:49 AlexAlex 1,0553 gold badges17 silver badges32 bronze badges 8
  • 1 There is no such method refresh() on a table element in plain DOM. How would your table element know where to get its data? What is the source of the data? Do you need to pull it from a database? There would be no other way than AJAX to refresh your table with new data, as you probably need to do some server side processing. What technologies are you using? – Cᴏʀʏ Commented Jun 20, 2012 at 20:51
  • Sorry, but you can't do this without ajax – lbstr Commented Jun 20, 2012 at 20:51
  • Wow, I came across a site that said there was one. Ill make sure not to go there again – Alex Commented Jun 20, 2012 at 20:52
  • Cory, help.dottoro./ljpoljcl.php – Alex Commented Jun 20, 2012 at 20:54
  • 2 @Alex: This seems to be some old proprietary Microsoft extension (see how it is only supported in IE?). Anyways, as the description says, this is for refreshing the style of a table, after you changed CSS rules. This has nothing to do with Ajax. – Felix Kling Commented Jun 20, 2012 at 20:57
 |  Show 3 more ments

1 Answer 1

Reset to default 5

There is no such JavaScript method. You are going to have to learn how to use Ajax.

You may want to look into using jQuery and its ajax() method. jQuery makes Ajax much easier to understand. Here is an example of jquery's ajax method.

$.ajax({
    type: "POST",
    url: "pathToPage",
    data: "yourParamsToGetData",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (result) {
        FillTableFromResults(result);
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        if (errorThrown != null)
            alert(textStatus + " : " + errorThrown);
    }
});

本文标签: htmlJavascript refresh() methodStack Overflow