我有一个接受查询并使用 yahoo websearch 返回建议的代码。它在 FF 和 Chrome 中工作正常。但在 IE 中它没有给出任何结果。谁能帮我解决这个问题吗?
这是代码:
$(document).ready(function() {
$.ajax({
type: 'GET',
url: "dummyapi.php",
data: {query: "yaho"},
success: function(xml) {
alert($("Result",xml).text());
/* do something here */
},
error: function(xhr, type, exception) { alert("Error: " + type); }
});
});
dummyapi.php
$Squery = $_GET['query'];
$appid = "S8YhyGzV34HB2jaWxc9VsNIPqeeg0OwqV.WQ0IvF1lblZsUiFzlyEs12kVyH5_IT";
$u = "http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=".$appid."&query=".$Squery;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($ch);
curl_close($ch);
echo $xml;
最佳答案
看来你错过了结束}); $.ajax 的文件,除非它没有显示在那里。
关于javascript - IE 的 jquery 问题....在 Firefox n chrome 中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/973757/