<div class="codetitle"> <span><a style="CURSOR: pointer" data="15272" class="copybut" id="copybut15272" onclick="doCopy('code15272')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code15272"> <br><dt style="margin:15px 0pxx 3pxpadding:0px; border:0px; font-weight:bold; color:rgb(4,121,167); font-family:Verdana,Arial,宋體; background-color:rgb(249,249,249)">dataType <br>類型:String <br>預期伺服器回傳的資料型態。如果不指定,jQuery 會自動根據HTTP 套件MIME 資訊來智慧判斷,例如XML <br>MIME 類型就被辨識為XML <br> </dt> <dt style="margin:15px 0px 3px; padding:0px; border:0px; font-weight:bold; color:rgb(4,121,167); font-family:Verdana,Arial,宋體; background-color:rgb(249,249,249)"> <br> </dt> <br> </div> <div class="codetitle"> <span><a style="CURSOR: pointer" data="6986" class="copybut" id="copybut6986" onclick="doCopy('code6986')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code6986"> <br> <br><br><br> <br> <br><br><br> <br> <br><script type="textRIP /javascript" src="jquery-1.8.2.min.js"></script> <br><script type="text/javascript"> <BR>function text(){ <BR>// alert($ ("input[name='text']").val() "aaaaaaaaa"); <BR>// post 傳值<BR>$.post( <BR>"index.php", //引號不能忘記加<BR>{ <BR>val:$("input[name='text']").val() <BR>}, <br>function(data){ <br>if(data=='1 '){ <BR>alert("這是text傳值 傳遞過來的值是" data); <BR>} <BR>}, <BR>"text" //引號不能忘記加上<BR>) <BR>} <BR><BR>function json(){ <BR>//get 傳值<BR>$.get( <BR>"index1.php", <BR>{ <BR>val:$("input[name='json']").val() <BR>}, <br>function(data){ <br>if(data=='1'){ <BR>alert("這是json傳值 值為" data); <BR>} <BR>}, <BR>'json' <BR>) <BR>} </script> </div> <br> <br> <div class="codetitle"> <input type="txt" name="text" id="text" onblur="text()"><span>dataType值為text</span><br> <span><input type="text" name="json" onblur="json()"><span>dataType值為json</span><br> <a style="CURSOR: pointer" data="84959" class="copybut" id="copybut84959" onclick="doCopy('code84959')"> <u> </u></a> </span>index .php程式碼</div> <div class="codebody" id="code84959"> <br><br><br>複製程式碼<br> </div> <br> 程式碼如下:<br><div class="codetitle"> <span><?php <a style="CURSOR: pointer" data="24480" class="copybut" id="copybut24480" onclick="doCopy('code24480')">echo "1 "; <u>?> </u> </span>index1.php程式碼</div> <div class="codebody" id="code24480"> <br><br><br>複製程式碼<br> </div>複製程式碼複製程式碼複製程式碼複製程式碼 程式碼如下: <?php <🎜>ECHO json_encode("1"); ?>