标签:decode [] 分享 asc call file 指定 比较 com
1 var xhr=new XMLHttpRequest(); 2 xhr.open(‘post‘,‘data.php‘); 3 xhr.setRequestHeader(‘Content-type‘,‘application/x-www-form-urlencoded‘); 4 xhr.send(‘userName=jack‘); 5 xhr.onreadystatechange = function(){ 6 if(xhr.readyState== 4 && xhr.status==200){ 7 console.log(xhr.responseText) 8 } 9 }
1 var xhr; 2 if(XMLHttpRequest){ 3 xhr = new XMLHttpRequest(); 4 }else{ 5 xhr = new ActiveXObject(‘Microsoft.XMLHTTP‘); 6 }
<!--[if lte IE 7]>
<script src="json2.js"></script>
<![endif]-->
1 function f1(obj) { 2 console.log(obj.result); 3 } 4 search.onclick=function(){ 5 var scr= document.createElement(‘script‘); 6 scr.src=‘http://api.jisuapi.com/qqluck/query?qq=‘ + phone.value + ‘&appkey=94c543ddb1a37c93&callback=f1‘; 7 document.head.appendChild(scr); 8 }
<?php $obj=file_get_contents(‘https://post.smzdm.com/home/json_more/?filter=all×ort=1533382571&p=2‘); echo $obj; ?>
1 $.ajax({ 2 url: ‘api/checkName.php‘, 3 type: ‘get‘, 4 data: ‘name=jack&age=16‘, 5 // data: { name:"jack",age:16 }, 如果传入对象,jquery内部会自动帮我们转换成那种key=value的字符串形式 6 success: function (obj) { 7 console.log(obj); 8 } 9 });
⑵ $.get
1 $.get({ 2 url:‘http://api.douban.com/v2/movie/top250‘, 3 dataType:"jsonp", 4 success: function (obj) { 5 console.log(obj); 6 } 7 });
⑶ $.post
1 $.post({ 2 url: ‘api/checkMobile.php‘, 3 data: ‘mobile=‘ + $(this).val(), 4 success: function (obj) { 5 console.log(obj); 6 } 7 });
标签:decode [] 分享 asc call file 指定 比较 com
原文地址:https://www.cnblogs.com/linqb/p/9527195.html