1
我有一個vb.net函數,我想從javascript調用都在.ascx。 在這段代碼中,我使用jquery彈出一個對話框,並單擊對話框上的按鈕(btnok),我想調用一個函數loadgraph(),它是一個vb.net函數。從JavaScript調用.ascx函數也是在.ascx
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="javascript/jquery-1.8.3.js" type="text/javascript"></script>
<script src="javascript/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
<link href="css/demos.css" rel="stylesheet" type="text/css" />
<script src="javascript/jquery-ui.js" type="text/javascript"></script>
<script>
// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function() {
$("#element_to_pop_up").dialog({
autoOpen: false,
show: "blind",
hide: "explode"
});
$("#button").click(function() {
$("#element_to_pop_up").dialog("open");
return false;
});
$("#btnok").click(function(){
$("#element_to_pop_up").dialog("close");
$.ajax({
type: "POST",
url: "Schart.ascx/loadgraph",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Do something interesting here.
alert("called")
}
});
return false;
});
});
</script>