我尝试使用JQuery从AJAX请求中提醒响应文本。将代码弹出到div或其他html标记时工作正常,但当我尝试提醒它时,我会在警报中的输出文本中附加一堆javascript代码。
以下是一些警告文字的示例:
baloney<script type="text/javascript">
if (("console" in window) ) {
console.info("Execution URL : /alerts/DismissAlert/2 Execution Time : 0.0330 sec, Memory Used : 1.421524 MB");
console.group("Errors");
console.error("Deprecated Function : Methods with the same name as their class will not be constructors in a future version of PHP;
&#13;
$(function() {
myFunction();
});
function myFunction(alertID) {
$.get('absolutePath' + alertID,
function (data, status) {
if (data !== 'false') {
/* gives me the right response text */
$('#aDiv').html(data);
/* gives me data with appended code >_< */
alert(data);
}
else {
alert('alert not dismissed');
}
}
);
}
&#13;
<div id="aDiv"></div>
&#13;