2
如何停止評估jquery ajax中的腳本標記併發布響應? 請找到相應的代碼below.The功能sendForm(),即使我使用dataType : 'text'
如何停止使用jquery ajax插入到DOM中時評估腳本標記或發佈
<HTML>
<HEAD>
<TITLE>This is the title</TITLE>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script>
<SCRIPT>
function get_info(url,data,callback,errorFunction)
{
$.ajax({ type: 'POST', url: url, data: data, success: callback, dataType: 'text', error: errorFunction, cache : false });
}
</SCRIPT>
</HEAD>
<BODY>
<A NAME="this"></A> <A HREF="#this" ONCLICK="get_info('Result1.lasso','temp=1&testParam=Rajesh',function(response){$(document.getElementById('test')).html(response);},function(){$(document.getElementById('test')).html('Error');})">Some Text</A>
<DIV id = 'test'></DIV>
</BODY>
</HTML>
Result1.Lasso
<script type="text/javascript">
function sendForm()
{
alert('hi');
}
</script>
<form name= "abc" method = "get" action = "abcd.lasso">
<input type ="text" name = "element1"/>
<input type = "button" value="Click" onClick = "javascript: sendForm();"/>
</form>