Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 如何在framework7中使用ajax_Json_Ajax_Jsonp_Html Framework 7 - Fatal编程技术网

Json 如何在framework7中使用ajax

Json 如何在framework7中使用ajax,json,ajax,jsonp,html-framework-7,Json,Ajax,Jsonp,Html Framework 7,我正在使用Framework7创建我的应用程序。我正在请求一些json数据,并使用jQuery将其显示在我的页面上。问题是,当我在index.html中使用代码时,它正在工作,但当我在应用程序的任何其他页面中使用代码时,它不工作,我只看到导航栏和空白页面。我在index.html和restaurant.html中使用了相同的jQuery脚本 实时工作演示代码 My index.html 斯里兰卡之旅 $.ajax({ 网址:'http://sonsofthunderstudio.in/jj/

我正在使用Framework7创建我的应用程序。我正在请求一些json数据,并使用jQuery将其显示在我的页面上。问题是,当我在
index.html
中使用代码时,它正在工作,但当我在应用程序的任何其他页面中使用代码时,它不工作,我只看到导航栏和空白页面。我在
index.html
restaurant.html
中使用了相同的jQuery脚本

实时工作演示代码

My index.html


斯里兰卡之旅
$.ajax({
网址:'http://sonsofthunderstudio.in/jj/jaffnahotels.json',
数据类型:“jsonp”,
JSONPCCallback:'jsonCallback',
键入:“get”,
跨域:是的,
cache:false,
成功:功能(数据){
$(data.jaffna)。每个(函数(索引、值){
console.log(值);
$(“.siteloader”).append(“
    ”+”
  • “+”
斯里兰卡之旅 框架7厨房水槽
我自己解决了

我从restaurant.html中移动了代码并粘贴到my-app.js中

我的餐厅.html


餐厅