I am doing simple post request through jquery and reading data from it on localhost.
My script works ok if i access the file through localhost , but if i access the file by double clicking it on console it says me 200 ok in red text and i dont get any response . My file name is send.html and it is sending data through jquery . my code is
<script src=".9.1.js"></script>
<script>
$(document).ready(function (){
var counter =1 , array_counter =0;
var picture_id_array=new Array(6);
picture_id_array[1] = new Array(3);
$.ajax({
type: "POST",
data : $(this).serialize(),
cache: false,
url: "http://localhost/CI/index.php/page/id/1",
success: function(data){
var obj = jQuery.parseJSON(data);
var json = $.parseJSON(data);
$(json).each(function(i,val){
$.each(val,function(k,v){
console.log(k+" : "+ v);
}
});
});
it says me about this line in jquery cause the error
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
I tried one solution which is to putt datatype:JSONP but it didnt give me the result .