" SyntaxError:意外令牌:" zipcodeapi示例JSONP [英] "SyntaxError: Unexpected token : " zipcodeapi example JSONP

查看:85
本文介绍了" SyntaxError:意外令牌:" zipcodeapi示例JSONP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $.ajax({
    url:"https://www.zipcodeapi.com/rest/kQvPAFvKlaGM1g2SoOzWcGoK0auNuT2PKyEle95zjMll2odrcMootN8tXDhsxkhh/radius.json/20151/5/mile",
            jsonp: "callback",
            dataType: "jsonp",
            data: {
                format: "json"
            },
            success: function( response ) {
                console.log( response ); 
            }
        });  

我在通过本地主机进行ajax调用时遇到问题.我想知道为什么会收到错误"SyntaxError:意外令牌:".有人可以帮我吗?谢谢!

I am having a problem with making an ajax call through my localhost. I was wondering why I am getting the error "SyntaxError: Unexpected token : ". Can someone please help me out? Thanks!

推荐答案

您需要在 https上设置客户端访问权限://www.zipcodeapi.com

如果选择应用程序管理"部分并输入详细信息,则应该可以输入域名.

If you select the "App Management" section and enter your details you should be able to enter your domain name.

使此本地运行的唯一方法是设置本地Web服务器,如果该服务器在localhost上运行,请输入localhost作为域之一.

The only way to get this working locally will be to set up a local webserver and if this is running on localhost, enter localhost as one of the domains.

这篇关于" SyntaxError:意外令牌:" zipcodeapi示例JSONP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆