2013-06-05 51 views
1

这里之后是代码AJAX:无法加载XML数据刷新整个页面

var dataStore = (function() { 
var _0x68ccx52; 
$['ajax']({ 
     type: 'GET', 

      url: 'xml/langSelectionsBeta.xml', 
      dataType: 'xml', 
      success: function (_0x68ccx2c) { 
       alert("success"); 
       _0x68ccx52 = _0x68ccx2c; 
      } 
     }); 
    return { 
     getXml: function() { 
      if (_0x68ccx52) { 
       return _0x68ccx52; 
      } 
      else{ 
       alert("FAIL"); 
       return _0x68ccx52; 
      } 
     } 
    }; 
})(); 

var data = dataStore['getXml'](); 

数据始终可以装载除了刷新整个页面; “失败”始终显示在“成功”之前。有没有任何方法来刷新页面?

回答

1
 $['ajax']({ 
      type: 'GET', 
      url: 'xml/langSelectionsBeta.xml', 
      dataType: 'xml', 
      success: function (data) { 
       dataStore.getXml = function() { 
        return data; 
       }; 
       //function that you want to do after receiving the data 
       //eg. setLanguage(_0x68ccx10); 
      } 

     }); 
相关问题