未捕获的语法错误:错误意外令牌:尝试使用Rails Web服务时

时间:2012-05-02 08:01:01

标签: ajax html5 jquery flexigrid

我正在尝试在我的html页面中使用Ruby on Rails RESTful Webservices ..

我收到了json响应但是语法错误:错误意外令牌:..

我试图在flexigrid中使用那个json数据..

这是我的代码......

<!-- Copyright (c) 2012 Mobile Developer Solutions -->
<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <title>MDS PhoneGap API Demo with jQuery Mobile</title>

    <link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.0.1.min.css" />
    <link rel="stylesheet" href="css/flexgrid/flexigrid.css" />
    <link rel="stylesheet" href="css/popup/jquery-ui.css" />

    <script type="text/javascript" src="jquery.mobile/jquery-1.6.4.min"></script>
    <script type="text/javascript" src="jquery.mobile/jquery.mobile-1.0.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery.cookie.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery-ui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/flexgrid/flexigrid.js"></script>

  <script type="text/javascript">
    var idt=0;  
    var $dialog;
    var $editDialog;
    var $showDialog;
    var id;
    $(document).ready(function(){   
        $("#flex1").flexigrid({
                url: 'http://10.10.8.35:3000/users/grid_data',
                dataType: 'jsonp',
                type: 'GET',
                processData: false,
                contentType: "application/json",
                colModel : [
                    {display: '<input type="checkbox" id="chkAllFile" onclick="javascript:CheckAll(this);"/>', name: '', width: 20, sortable: false, align: 'center', process: AttachCheckBox},
                    {display: 'Edit', name : 'edit', width : 20, sortable : true, align: 'center',process:EditUser},
                    {display: 'Delete', name : 'delete', width : 30, sortable : true, align: 'center',process:DeleteUser},
                    {display: 'ID', name : 'id', width : 20, sortable : true, align: 'center'},
                    {display: 'First Name', name : 'firstname', width : 90, sortable : true, align: 'left',process:ShowUser},
                    {display: 'Last Name', name : 'lastname', width : 90, sortable : true, align: 'left'},
                    {display: 'Email', name : 'email', width : 180, sortable : true, align: 'left'}             
                    ],
                buttons : [
                    {name: 'Add User', bclass: 'add', onpress : AddUser},
                    {separator: true}
                    ],
                searchitems : [
                    {display: 'firstname', name : 'firstname'},
                    {display: 'email', name : 'email', isdefault: true}
                    ],
                sortname: "id",
                sortorder: "asc",
                usepager: true,
                useRp: true,
                rp: 10,         
                showTableToggleBtn: true,
                width: 515,
                height: 255
                });                
    });

  </script>
    </head>

  <body>
    <div data-role="page" class="type-interior" data-theme="b">

    <div data-role="header" data-theme="b">
        <h1>Demo</h1>
    </div>

    <div data-role="content" data-theme="c">            
        <h1 style="float:left;">Users</h1>
        <div style="clear:both;"></div>
        <div id="somediv"></div>
        <div class="Flexgrids"> 
            <table id="flex1" style="display:none"></table>
            <div id='confirm'>
                <div class='header'><span>Confirm</span></div>
                    <div class='message'></div>
                    <div class='buttons'>
                    <div class='no simplemodal-close'>No</div><div class='yes'>Yes</div>
                </div>
            </div> 
        </div>
    </div>

    <div data-role="footer" data-theme="b">
        <p>&copy; 2012 Mobile Developer Solutions</p>
    </div>  
    </div>  
  </body>
</html>

请帮帮我们......

你认为我是以正确的方式呼叫服务......

我收到Uncaught Syntax错误:意外的令牌:....

请我解决这个问题......

提前致谢...... !!!

0 个答案:

没有答案