-2
所以我没有很多Javascript的经验,但是我在过去做得很好。我有这个网站,我试图运行'geoip'来拉两个iso到一个特定的页面,我已经得到完美的功能。然而,如果所述ISO完成购买,则向他们呈现谢谢页面,但是因为“geoip”仍然存在而消失。我试过运行一个'返回',但似乎无法得到它的窍门。在崇高的文本3看起来很好,任何帮助将非常感激。这里是我的代码:SyntaxError:意外的令牌else
$.ajax({
url: 'https://freegeoip.net/json/',
type: 'POST',
dataType: 'jsonp',
success: function(location) {
// If the visitor is browsing from Australia or New Zealand.
if (location.country_code == 'AU' || location.country_code == 'NZ') {
// Redirect visitor to the purchasing store.
window.location.href = 'http://example.com/order-international/';
else {
location.country_code == 'AU' || location.country_code == 'NZ' === window.location.href = 'http://example.com/thanks-international/') {
return; //stop the execution of function
} else {
//keep on going
}
}
}
});
欢迎来到Stack Overflow!正如标题文本框中的占位符所建议的,您的问题的标题应该是问题的简短版本,而不是“请帮助我”或类似内容。 – 2015-03-08 18:21:07
我已经清理了您的代码格式。看看结果,我怀疑你有一对错位的“{}”(至少,似乎还有其他问题)。 – 2015-03-08 18:24:48
使用'GET' for jsonp – charlietfl 2015-03-08 18:24:49