• jQuery Ajax 简单的实现跨域请求


    html 代码清单:

    [html]
    1. <script type="text/javascript" src="http://www.youxiaju.com/js/jquery-1.4.2.min.js"></script>  
    2. <script type="text/javascript">  
    3. $(function(){  
    4. $.ajax(  
    5.     {  
    6.         type:'get',  
    7.         url : 'http://www.youxiaju.com/validate.php?loginuser=lee&loginpass=123456',  
    8.         dataType : 'jsonp',  
    9.         jsonp:"jsoncallback",  
    10.         success  : function(data) {  
    11.             alert("用户名:"+ data.user +" 密码:"+ data.pass);  
    12.         },  
    13.         error : function() {  
    14.             alert('fail');  
    15.         }  
    16.     }  
    17. );  
    18. })  
    19. </script>  


    服务端 validate.php 代码清单:

    [php]
    1. <?php  
    2. header('Content-Type:text/html;Charset=utf-8');  
    3. $arr = array(  
    4.     "user" => $_GET['loginuser'],  
    5.     "pass" => $_GET['loginpass'],  
    6.     "name" => 'response'  
    7.   
    8. );  
    9. echo $_GET['jsoncallback'] . "(".json_encode($arr).")";  


    效果图:

    详情链接:http://blog.csdn.net/liruxing1715/article/details/18707605

  • 相关阅读:
    在弹出窗口中显示带checkbox的
    列属性设定-隐藏列
    Aggregations应用-合计(total)、小计(subtotal)、平均值(average)
    排序(sort)、小计(subtotal)
    过滤器(filter)
    显示图标(ICON)和提示信息(Tooltips)
    单元格style应用-按钮、热点(hotspot)、checkbox等
    布局列分组
    图床-1
    q-1
  • 原文地址:https://www.cnblogs.com/shaohuixia/p/5504360.html
Copyright © 2020-2023  润新知