不返回数据

时间:2013-11-23 08:05:27

标签: jquery sharepoint

我在sharepoint 2010中使用了一个Web服务,并尝试在sharepoint 2013 Web部件中调用它。但是在加载Web部件时我得到的字符串格式不正确错误

   private string GetPageFormat()
        {
            string pageFormat = string.Empty;
            pageFormat += string.Format(@"
<link href=""../../../_layouts/VProject/recentProjectsStyles.css"" rel=""stylesheet"" type=""text/css"" />
<link href=""../../../_layouts/VProject/recentProjectsStyles.css"" rel=""stylesheet"" type=""text/css"" />
 <script src=""http://code.jquery.com/jquery-latest.js"" type=""text/javascript""></script>


   <div class=""projects-recentProj-header"">
        Recent Projects
    </div>
   <script type=""text/javascript"">

var pageid = 1;
        var UrlGlobal;
        var projectsGlobal;
        var projectvalGlobal;
        var browserVar;
        var val = 0;
        var count = 0;

  $(""#s4-workspace"").ready(function () {{

       UrlGlobal = ""http://cs-sp2010svc.virtusa.com:3636/ProjectHome/ProjectService.svc/web/GetRecentProjects?method=JsonPCallBack&pageID=1"";
 jsonp(UrlGlobal);
                            }});

 jsonp = function(UrlGlobal)
                        {{
                          $.ajax({{
                                    cache: false ,
                                    url: UrlGlobal,
                                    type: ""GET"",
                                    dataType: ""jsonp"",
                                    contentType: ""text/javascript"",
                                    success: function (data) {{
                                $('#ProjectMainWrapper').append('<div>Success in Employee Badges Details</div>');
                }},

                                 error: function (x, t, m) {{ 

                                      $('#ProjectMainWrapper').append('<div>Error in Employee Badges Details'+t+'</div>');

                                        }}

                                    }});    
                    }};

 JsonPCallBack = function(result) {{

            projectsGlobal = result;
            projectCountGlobal = result.length;
}};


</script>

    <div id=""ProjectMainWrapper""; style=""width:550px; position:relative"";>


    </div>  

    ");

            return pageFormat;
        }

当我在sharepoint中加载Web部件时,我收到了我在AJAX调用中定义的错误消息。但是当我复制并粘贴服务URL时,它会返回数据。我的代码有什么问题?

0 个答案:

没有答案