2012-12-27 75 views
0

當我通過URL我得到一個沒有來自url的反應,否則,如果我指定相應的WCF服務頁面,它包含在我的項目中工作是任何跨域問題可能是什麼問題URL字段不能與flexigrid沒有響應從URL

<form id="sform" runat="server"> 
    <table id="flex2" style="display:none"></table> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      var user_id = 1; 
      var data = { UserID: user_id }; 

     $("#flex2").flexigrid({ 

      useInlineEditor: true, 
      //singleSelect: true, 
      rowClick: function (row) { 
       //var r=this.DataSource.rows[row.rowIndex]; 
       //var p=$(row).offset(); 
       //alert(r[this.DataSource.key]+" "+r.Name+" offset:"+p.top+","+p.left); 
       //this.grid.inlineEditor.edit(row); 
      }, 

      url: 'http://192.168.10.91:5001/Service.svc/GetStates', 
      method: 'POST', 
      dataType: 'json', 
      colModel: [ 
      { display: 'Hours', name: 'hours', width: 40, sortable: true, align: 'center' }, 
      { display: 'DOC', name: 'doc', width: 180, sortable: true, align: 'left' }, 
      ], 
      searchitems: [ 
      { display: 'Type', name: 'cmetype' } 
      ], 
      onError: function (jqXHR, textStatus, errorThrown) { 
       alert("flexigrid failed " + errorThrown + jqXHR + textStatus); 
      }, 
      sortname: "type", 
      sortorder: "asc", 
      usepager: true, 
      title: 'States', 
      useRp: true, 
      rp: 15, 
      showTableToggleBtn: true, 
      width: 800, 
      height: 200 
     }); 
    }); 

    //This function adds paramaters to the post of flexigrid. You can add a verification as well by return to false if you don't want flexigrid to submit   
    function addFormData() { 
     //passing a form object to serializeArray will get the valid data from all the objects, but, if the you pass a non-form object, you have to specify the input elements that the data will come from 
     var dt = $('#sform').serializeArray(); 
     $("#flex2").flexOptions({ params: dt }); 
     return true; 
    } 

    $('#sform').submit(function() { 
     $('#flex2').flexOptions({ newp: 1 }).flexReload(); 
     return false; 
    }); 
</script> 
</form> 

回答

0

請確保svc服務是accesibile,並且它可以接受發佈請求。 如果一切正常,請檢查響應是否爲JSON並且有效。