Copy Code code as follows:
<dt style= "margin:15px 0px 3px; padding:0px; border:0px; Font-weight:bold; Color:rgb (4,121,167); Font-family:verdana,arial, song body; Background-color:rgb (249,249,249) ">datatype
Type: String
The type of data expected to be returned by the server. If not specified, JQuery will automatically intelligently judge against HTTP Packet MIME information, such as XML
MIME types are recognized as XML
</dt><dt style= "margin:15px 0px 3px; padding:0px; border:0px; Font-weight:bold; Color:rgb (4,121,167); Font-family:verdana,arial, song body; Background-color:rgb (249,249,249) ">
</dt>
Copy Code code as follows:
<script type= "Text/javascript" src= ' jquery-1.8.2.min.js ' ></SCRIPT>
<script type= "Text/javascript" >
function text () {
Alert ($ ("input[name= ' text ']"). Val () + "aaaaaaaaa");
Post Pass Value
$.post (
"index.php",//quotes can not forget to add
{
val:$ ("input[name= ' text ')"). Val ()
},
function (data) {
if (data== ' 1 ') {
Alert ("This is the text pass value \ nthe value is passed over is" +data);
}
},
"Text"/quotation marks cannot be forgotten plus
)
}
function json () {
Get Pass Value
$.get (
"Index1.php",
{
val:$ ("Input[name= ' json ')"). Val ()
},
function (data) {
if (data== ' 1 ') {
Alert ("This is the JSON pass value \ n value is" +data);
}
},
' JSON '
)
}
</SCRIPT>
<body>
<input type= ' txt ' name= ' text ' id= ' text ' onblur= ' text () '/><span>datatype value is text</span><br>
<input type= ' text ' name= ' json ' onblur= ' json () ' ><span>datatype value is json</span><br/>
</body>
index.php Code
Copy Code code as follows:
index1.php Code
Copy Code code as follows:
<?php
ECHO Json_encode ("1");
?>