Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can any point me to the error am doing in this block of code. This is working fine in Internet Explorer and Firefox but not in Chrome. Chrome does not return the result.

   function CallListWS_PublishedLib(m, ctx) {

 var ReviseStatus;
 var isHyperLink;

  if(ctx.listTemplate == 10055)
    {
   var soapEnv =  "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
        <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>" + ctx.listName + "</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Revise' /> \
                           <FieldRef Name='Is_x0020_HyperLink_x003F_' /> \
                       </ViewFields> \
                    </viewFields> \
                    <query> \
                        <Query><Where> \
                            <Eq> \
                                <FieldRef Name='ID' /> \
                                <Value Type='Integer'>" + currentItemID + "</Value> \
                            </Eq> \
                        </Where></Query>\
                    </query> \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>";


     var wsurl = ctx.HttpRoot + "/_vti_bin/lists.asmx";
     var strAction="STSNavigate('"+ctx.HttpRoot + "/_layouts/IHIS.MOSS.SGH.Solution/ReviseDocument.aspx?" + "ID=" + currentItemID + "&List=" + ctx.listName +"')";




    $.ajax({
        async: false,
        url: wsurl,
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: function(xData, status) {
             ReviseStatus = $(xData.responseXML).find("z\\:row:eq(0)").attr("ows_Revise");
             isHyperLink = $(xData.responseXML).find("z\\:row:eq(0)").attr("ows_Is_x0020_HyperLink_x003F_");

        },
        contentType: "text/xml; charset=utf-8"
    });
    }

    alert(ReviseStatus);
    alert(isHyperLink);


    return [ReviseStatus, isHyperLink];
}
share|improve this question
    
add 'error: function(response, status, error) { console.log(status + "-" + error) }' to your list of ajax options. This will give you a little better idea of whats happening. Then change 'complete:' to 'success:'. Complete fires either way and you only want to run to run your code if it actually works. –  andrew.petersen15 Mar 15 '13 at 17:11
    
Also, what version of jquery are you using? –  andrew.petersen15 Mar 15 '13 at 17:12
add comment

2 Answers 2

What version of SharePoint are you in? 2010? 2007? Also, is chrome giving you any kind of error when you look at the call through the debugging tools. Check the console and the network tools to see if the call is going through. There are several options available for SharePoint web services so you do not have to create the soap packages yourself. In 2007/ 2010 you can use spservices for SharePoint. The guy who made that library is a awesome and a real expert in the SharePoint world. In 2010 you can use the JavaScript object model for SharePoint or REST for SharePoint. Examples can be found here. If you need more examples let me know.

share|improve this answer
    
thanks i was able to see the response of webservice through the chrome developer tools. The problem was with cross browser functionality. found the problem as noted in the below link maxmorrow.wordpress.com/2012/06/17/… –  user14929 Apr 20 '13 at 9:33
add comment

The problem lied in the xml response as detailed below link. http://maxmorrow.wordpress.com/2012/06/17/jquery-caml-query-lists-asmx-web-service/

i changed the below lines and worked fine in chrome and firefox.

InternalStatus = $(xData.responseXML).find("z\:row:eq(0),row:eq(0)").attr("ows_Internal_x0020_Status"); isHyperLink = $(xData.responseXML).find("z\:row:eq(0),row:eq(0)").attr("ows_Is_x0020_HyperLink_x003F_");

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.