zoukankan      html  css  js  c++  java
  • AJAX

    1、使用 .ajax

    <script type="text/javascript">

    $(function(){

             $( "#obj1" ).autocomplete({

                       source: "__CONTROLLER__/search",

                       minLength: 2,

                       autoFocus: true

             });

    });

    function GetUserValues()

    {

             var company=$("#obj1").val();

             var action='getinfo';

             var para= {company:company,action:action};

             var url = "Data/index"; 

             $.ajax({ 

             type: "get", 

             url: url, 

             dataType: "json",  

             data: para, 

             success: function(msg){

                       //alert(msg);

                       $("#obj2").val(msg.company2);

                       $("#obj3").val(msg.company3);

                      $("#obj4").val(msg.company4);

                       $("#obj5").val(msg.linkman);

                       $("#obj6").val(msg.mobile);             

                       $("#obj9").val(msg.city);         

             } 

             });            

    }

    </script>

    <input type="text" class="inpt1" name="obj1" id="obj1" onblur="return GetUserValues();" /> <small>*</small>   

    2、使用 .post

    <script type="text/javascript">

        function call_js()

        {

            var score=0 ;

            var itemID = {$data.id};

            ok();

            score = $("#my_score").val();      

            //alert("my score = "+score);

            $.post("__CONTROLLER__/saveexam",{itemID:itemID,score:score}, 

                function(data){

                //alert(data);

                    if(data=="error"){       

                        alert('考试成绩保存失败,请联系管理员');   

                    }    

                });

        }

    </script>

    <span id="submit_box"><img src="__PUBLIC__/Images/home/bnt7.jpg" class="img2" onclick="call_js()" /></span>

  • 相关阅读:
    git 提交解决冲突(转载)
    impala系列: 时间函数
    impala系列: 字符串函数
    Impala系列: Impala常用的功能函数
    impala系列:impala特有的操作符
    impala系列: 同步Hive元数据和收集统计信息
    ETL脚本的版本管理方法和 SourceTree 使用
    几本不错的数据仓库和Hadoop书籍
    Kudu系列-基础
    sql parser
  • 原文地址:https://www.cnblogs.com/xihong2014/p/5275227.html
Copyright © 2011-2022 走看看