在尝试了此问题和许多其他问题的解决方案之后,我无法在代码中得到确切的问题。我的密码
$(document).ready(function() {
$("#botname").blur(function() {
$.ajax({
type: "POST",
url: "/tukaiexotic/rq/requisition/typhead",
contentType: "application/json; charset=utf-8",
success: function(result) {
$("#commmonname").val(result);
}
});
});
});
它返回我的预期结果,但结果是,它返回整个页面的HTML代码。
代码有什么问题?
服务器端脚本
function typhead_mod()
{
$this->db->select("fa_id,fa_code,fa_name");
$aaa=$this->db->get('tukai_farms')->result();
echo strip_tags($aaa);
}
从服务器文件发送数据时使用strip_tags,如果它在php中,如下所示-
<script src="jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$.ajax({
type: "POST",
url: "test2.php",
contentType: "application/json; charset=utf-8",
success: function(result) {
//alert(result);
$("#commmonname").html(result);
}
});
});
</script>
<div id="commmonname"></div>
服务器文件
<?php
$msg="<h2>HI</h2>";
echo strip_tags($msg);
?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句