标签:
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>
标签:
原文地址:http://www.cnblogs.com/xihong2014/p/5275227.html