Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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
如何更改我的<;p>;使用jquery_Jquery - Fatal编程技术网

如何更改我的<;p>;使用jquery

如何更改我的<;p>;使用jquery,jquery,Jquery,我的jQuery非常生疏,但我是从API调用的,响应显示在console.log中很好,但在页面加载时它不会填充标记。我不断地发现这个错误: 未捕获的语法错误:意外标记( 我的对象在console.log中运行良好,因此我假设它是我的jQuery @{ ViewBag.Title = "LondonsWeather"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2>LondonsWeather</h2> <p

我的jQuery非常生疏,但我是从API调用的,响应显示在console.log中很好,但在页面加载时它不会填充
标记。我不断地发现这个错误:

未捕获的语法错误:意外标记(

我的对象在console.log中运行良好,因此我假设它是我的jQuery

@{
ViewBag.Title = "LondonsWeather";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>LondonsWeather</h2>

 <p id ="timezone"></p>
 <p id ="time"></p>
 <p id ="currently"></p>



<script>

$(document).ready(function() {

    $.get("@Url.Action("GetLondonsWeather", "Weather")",
        function(response) {


            console.log(response.timezone);
            console.log(response.currently.time);
            console.log(response.currently.summary);
            console.log(response.currently.temperature);


            $.("#timezone").text(response.timezone);
            $.("#time").text(response.time);
            $.("#currently").text(response.currently.summary);

        });

});
@{
ViewBag.Title=“Londonsweagher”;
Layout=“~/Views/Shared/_Layout.cshtml”;
}
伦敦人

$(文档).ready(函数(){ $.get(“@Url.Action”(“GetLondonSweagher”,“天气”)”, 功能(响应){ console.log(response.timezone); log(response.current.time); log(response.current.summary); console.log(响应.当前.温度); $.(“#时区”).text(response.timezone); $.(“#时间”).text(response.time); $.(“#当前”).text(response.current.summary); }); });

试试这个,你犯了一个打字错误。这是一个完美的jQuery语法

$("#timezone").text(response.timezone);
$("#time").text(response.time);
$("#currently").text(response.currently.summary);

不是
$(“#时区”)
而是
$(“#时区”)
。不需要那个时间段。这就解决了它!多尴尬啊……jQuery需要一些认真的工作哈哈。/这不是jQuery的问题。这是语法问题。“简单的排版问题”有一个接近主题的原因。