2

私はjqueryを介して簡単な投稿リクエストを行い、localhostでデータを読み取っています。

localhost を介してファイルにアクセスすると、スクリプトは正常に動作しますが、コンソールでダブルクリックしてファイルにアクセスすると、赤いテキストで 200 OK と表示され、応答がありません。私のファイル名は send.html で、 jquery を介してデータを送信しています。私のコードは

<script src="http://code.jquery.com/jquery-1.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);    
                            }
                          });
                  });

jqueryのこの行についてエラーが発生すると言われています

 // 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 );

datatype:JSONP を配置するという1つの解決策を試しましたが、結果が得られませんでした。

4

0 に答える 0