大佬教程收集整理的这篇文章主要介绍了你能在jQuery中为getJSON添加标题吗?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要传递:“X-Mashape-Key:KEY_HERE”我看到它可以在ajax中完成,但不知道如何将getJSON重写为循环,但可以在这里看到:
http://blog.mashape.com/mashape-sample-code-executing-ajax-request-using-jquery/
$.getJSON(setTings.apiPath + setTings.username + '/boards/',function (data) { beforeSend: setHeader,console.log(data); for (var i = 0; i < setTings.count; i++) { var Feed = false; if(data.data[i]) { Feed = data.data[i]; } var temp_data = { message: truncate(Feed["message"],100),url: Feed["link"] }; $('#pinterestFeed ul').append('<li class="Feed">' + templaTing(temp_data) + '</li>'); } $(".pinterest #loading").hide(); });
$.ajax({ dataType: "json",url: url,data: data,success: success });
所以你可以直接使用它
$.ajax({ beforeSend: function(request) { request.setrequestHeader("X-Mashape-Key",'key_here'); },dataType: "json",url: setTings.apiPath + setTings.username + '/boards/',success: function(data) { //Your code } });
以上是大佬教程为你收集整理的你能在jQuery中为getJSON添加标题吗?全部内容,希望文章能够帮你解决你能在jQuery中为getJSON添加标题吗?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。