开发者

can i force jquerymobile to load pages via ajax (not external)?

开发者 https://www.devze.com 2023-03-26 12:00 出处:网络
There are several ways to force an external load (data-ajax=\"false\", rel=\"external\"), but what if I have an external link that will serve me a jquery mobile page and I want it to load via ajax wit

There are several ways to force an external load (data-ajax="false", rel="external"), but what if I have an external link that will serve me a jquery mobile page and I want it to load via ajax with transitions (without the page reloading)? Anyone have a straightforward开发者_JAVA技巧 solution?

The reason I'm asking is that I'm building a PhoneGap IOS app and the index.html file is no longer on the same path as the pages that are being fetched.

Thanks


You can use framework such as jQTouch or jQuery Mobile. These frameworks have built in functions which can help you in call cross domain AJAX calls with in the application it self.

For example:

$.get("test.php", 
  { name: "micky", time: "2pm" }, 
  function(data){ 
    alert("Data Loaded: " + data); 
  } 
);

See demo here: http://jqtouch.com/preview/demos/ but make sure to use web kit enabled browsers such as Chrome/Safari.

0

精彩评论

暂无评论...
验证码 换一张
取 消