简体   繁体   English

jQuery getJSON递归调用

[英]jquery getJSON recursive call

I have the following code for retrieving data from DB and setting up a grid. 我有以下代码用于从数据库检索数据并设置网格。
Once I manipulate the grid, and saved in DB, I want the grid to be loaded again. 一旦操纵了网格并将其保存在DB中,我就希望再次加载网格。
How do I call getJSON again to reload the data and the grid? 如何再次调用getJSON以重新加载数据和网格?

var jqxhr = $.getJSON('/Test/GetData', function () {}).done(function () {
         //Load grid using data in jqxhr into grid
         //Manipulte data in grid and save in DB
         // At this point I want to call $.getJSON to refresh the grid
});

How about something like 怎么样

function loadData(repeat) {
  var jqxhr = $.getJSON('/Test/GetData', function () {}).done(function () {
    //Load grid using data in jqxhr into grid
    //Manipulte data in grid and save in DB
    // At this point I want to call $.getJSON to refresh the grid
    if (repeat) loadData(false);
  });
}
loadData(true);

This should loop one time. 这应该循环一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM