添加了magicSuggest.js和css文件 无法从服务器端获取数据。
请在下方提供代码并提供帮助。
<script type="text/javascript" >
$(document).ready(function () {
$('#magicsuggest').magicSuggest({
data: "Default.aspx/GetAutoCompleteData"
});
});
</script>
''在Codebehind页面vb.net中使用的Webmethod
<WebMethod()> _
Public Shared Function GetAutoCompleteData() As String
Dim Str as string=""
''I have serialized my string into JSON by using serializer
''For Example I have returned string which explained on demo site
''http://nicolasbize.com/magicsuggest/doc.html
Dim Serializer As New JavaScriptSerializer
str = Serializer.Serialize(strArr)
-
-
-
-
-
'I have sent following strings to check the Output but failed.
'Returning string As JSON format for
''**ex1**:[{'id':'Paris', 'name':'Paris'}, {'id':'New York', 'name':'New York'}]
''**ex2**:['PARIS','NEW YORK']
return str
End Function
我已经通过在Javascript代码中放置ex1和ex2字符串来尝试它,它正常工作
当我在浏览器URL中执行 Default.aspx / GetAutoCompleteData 时,它会隐藏magicSuggest div。
请帮我从服务器端获取这些字符串。