jquery's weird behaviour jquery's weird behaviour codeigniter codeigniter

jquery's weird behaviour


Try to use .ajax jQuery method with specified failure function (error variable) in method parameters. If something going wrong on server side or you have another specific error, you'll be able to analyze XMLHttpRequest, textStatus, errorThrown variables


I am always using the following style...

ajax({   type: "POST",   url: 'index.php/contact/getorg',   data: JSON.stringify({'query':$('#org_name').val()}),   dataType: "json",   contentType: "application/json; charset=utf-8",   success: function (data) {      $('#showorg').html(JSON.parse(data.d));   },   error: showError};function showError(responseText, statusText, xhr, $form) {            debugger;         }

EDIT:

And also the line console.log(org_name); seems not correct. Where is the member org_name comming from?


thanks for the response guys, that error call back method helped me a lot. It was giving 404 method, so i changed the url. Now its working like charm. Let me share with you all what i did:

$('#org_name').bind('change',function(){  $("#showorg").html("wait...");  $.ajax({    url: 'http://localhost/ifes/index.php/contact/getorg',    type: 'POST',    dataType: 'html',    data:{'query':$('#org_name').val()},    timeout: 1000,    error: function(xhr,err){    alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);    alert("responseText: "+xhr.responseText);    },    success: function(data){        $('#showorg').html(data);// do something with data    }  });  });