欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery提示 "object expected"的解決方法

 更新時(shí)間:2009年12月13日 00:43:51   作者:  
在測(cè)試代碼的時(shí)候,提示object expected,下面的解決方法,可以參考下。
1. "object expected"錯(cuò)誤: 是jquery庫(kù)的引用方式不對(duì)引起的。
錯(cuò)誤的引用方式: <script src="/js/jquery-1.3.2.min.js" type="text/javascript"> </script>
正確的引用方式: <script language="javascript" type="text/javascript" src="../js/jquery-1.3.2.js"> </script>
另外包含js腳本的語(yǔ)法寫(xiě)法如下(書(shū)寫(xiě)不標(biāo)準(zhǔn)也會(huì)報(bào)錯(cuò)"object expected"):
<script language="javascript" type="text/javascript"></script>
2.Jquery在vs2005和vs2008中的語(yǔ)法也有很大不同(應(yīng)用時(shí)要稍加注意),比如:
復(fù)制代碼 代碼如下:

//無(wú)參數(shù)調(diào)用
$(document).ready(function() {
$('#btn1').click(function() {
$.ajax({
type: "POST",
contentType: "application/json",
url: "MyWebService2.asmx/HelloWorld",
data: "{}",
dataType: 'json',
success: function(result) {
$('#dictionary').append(result); ****** 注釋:vs2005回調(diào)函數(shù)中獲取返回值的方式。
}
});
});
});

//無(wú)參數(shù)調(diào)用
$(document).ready(function() {
$('#btn1').click(function() {
$.ajax({
type: "POST",
contentType: "application/json",
url: "WebService1.asmx/HelloWorld",
data: "{}",
dataType: 'json',
success: function(result) {
$('#dictionary').append(result.d); ****** 注釋:vs2008回調(diào)函數(shù)中獲取返回值的方式。
}
});
});
});

相關(guān)文章

最新評(píng)論