这是我的代码工作与zendFramwork1.2
$("#cboCateMain1").change(function(){
var id=$(this).val();
var dataString = 'catmainid='+ id;
$.ajax({
type: "GET",
url: "<?php echo $this->baseUrl ();?>/<?php echo $this->translate('lang')?>/<?php echo $this->controller?>/catemainindex",
data: dataString,
dataType: 'json',
cache: false,
contentType: "application/json;charset=utf-8",
beforeSend: function() {
},
timeout: 1000000,
error:function(xhr, status, error) {
alert('Error: Message->'+ xhr.status+ ' - >'+ error+"->"+xhr);
},
success: function(data){
alert(data);
}
});
});
但是我得到了错误,像!
错误有什么问题吗?期待您的回复。由于
这意味着您返回的json数据有问题。首先尝试向该请求返回一个硬编码json字符串。这里有一个很好的网站来验证json