最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery issue xhr.send( ( s.hasContent && s.data ) || null ); - Stack Overflow

programmeradmin0浏览0评论

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 .

发布评论

评论列表(0)

  1. 暂无评论