Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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
Javascript 如何使用jQuery插入多个HTML元素_Javascript_Jquery_Html_Css_Yahoo Weather Api - Fatal编程技术网

Javascript 如何使用jQuery插入多个HTML元素

Javascript 如何使用jQuery插入多个HTML元素,javascript,jquery,html,css,yahoo-weather-api,Javascript,Jquery,Html,Css,Yahoo Weather Api,我有一个网页,是从雅虎的数据!天气空气污染指数。我正在使用。我想使用jQuery构建一个表,该表插入ID为的元素。这是我目前的代码: $.gethttps://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20select%20woeid%20from%20geo.places1%20where%20text%3D%22canberra%22&forma

我有一个网页,是从雅虎的数据!天气空气污染指数。我正在使用。我想使用jQuery构建一个表,该表插入ID为的元素。这是我目前的代码:

$.gethttps://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20select%20woeid%20from%20geo.places1%20where%20text%3D%22canberra%22&format=json&env=store%3A%2F%2Fdatatables.org%2FallTables WithKeys,functiondata{ $title.appenddata.query.results.channel.title; $sunrise.appenddata.query.results.channel.astronomy.sunrise; $sunset.appenddata.query.results.channel.astronomy.sunset; $title-2.appenddata.query.results.channel.item.title; 对于变量i=0;i<10;i+=1{ var newRow=$.attrid,行-+i+1; var newDate=$.attrid,日期-+i+1; var newMin=$.attrid,min-+i+1; var newMax=$.attrid,max-+i+1; var newConditions=$.attrid,conditions-+i+1; $weather.newrow; $row-+i+1.appendnewDate、newMin、newMax、newConditions; $date-+i+1.appenddata.query.results.channel.item.forecast[i].day++data.query.results.channel.item.forecast[i].date; $min-+i+1.appendMath.floordata.query.results.channel.item.forecast[i].低温-32/1.8+°C; $max-+i+1.appendMath.floordata.query.results.channel.item.forecast[i]。高-32/1.8+°C; $conditions-+i+1.appenddata.query.results.channel.item.forecast[i].text; } $lastBuild.appenddata.query.results.channel.lastBuildDate; },json; 迪夫曼{ 宽度:595px; } 桌面天气{ 边界塌陷:塌陷; 宽度:595px; } 表格标题{ 宽度:595px; } 运输署, th{ 宽度:148.75px; 文本对齐:居中; } tr{ 高度:28px; } 日出: 日落: 日期 分钟 马克斯 条件
上次生成的数据:目前我觉得不错。如果您的页面只查询一次信息,那么只要它现在正常工作就可以了。如果您希望允许多个查询,例如允许用户选择日期并按下按钮检索另一天的信息,您可能希望在向相关元素添加新项目之前清空这些元素。

谢谢!我刚刚测试了它,它的工作非常出色!我的问题是一个好问题吗?通常一个好问题是询问某人在开发过程中遇到的问题。你的代码运行得很好,你主要是在征求意见或可能的改进,按照SO标准,这似乎不属于好问题类别。好的,谢谢。我只是想知道我的大部分帖子都是答案