当我执行一个简单的Ajax请求我收到以下错误错误Ajax请求
TypeError: 'toString' called on an object that does not implement interface HTMLAnchorElement.
这是我的AJAX脚本
<script type="text/javascript">
$(document).on("ready", function(){
$("#tabla_persona table tr").click(function() {
var cod = $("#identificador",this);
alert(cod.html());
var parametros={
"cod":cod
};
$.ajax({
type: 'POST',
url: '<?php echo site_url("archivo/prueba"); ?>',
data: parametros,
success: function(resp) {
$("#tabla_usuario_individual").html(resp);
}
});
});
});
</script>
这是我的控制器
public function prueba(){
$this->load->view('datos_persona');
}
和我简单的页面看到的结果
<a>
Prueba
</a>
什么类型的元素是'#identificador'? – Barmar
您正在传递一个jQuery对象('cod')作为数据'var parametros = {“cod”:cod};' – Andreas