前台js调用aspx.cs里面的方法????

JavaScript015

前台js调用aspx.cs里面的方法????,第1张

用coolite

Coolite.AjaxMethods.getComodityById(x,{

success:

function(result)//result函数的返回结果

{}

})

前台一定要有<ext:ScriptManager

ID="sm1"

runat="server"></ext:ScriptManager>

后台方法一定要加[AjaxMethod]

导入using

Coolite.Ext.Web命名空间,

<script type="text/javascript">

var oid = ""

oid = "<%=dt.Rows[0]["travel_id"].ToString() %>"

if(typeof(oid) != "undefined"){

$.ajax({

type:"GET",

url:"tieCount.ashx?oid="+oid+"&timestamp="+Math.random(),

cache:false,

success:function(msg)

{

$("#tieCount").html(msg)

}

})

}

else{

alert('线路编号为空')

}

</script>