Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SPServices return not working

$
0
0
I already solved the Picture worked it turned out that I misplaced the return p.

This is the complete code.

function getProfPic(username) {
    var p1 = "";
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "UserInfo",
        CAMLViewFields: "<ViewFields><FieldRef Name='ID'/><FieldRef Name='Account'/><FieldRef Name='Picture'/><FieldRef Name='Name'/></ViewFields>",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='Name'/><Value Type='Text'>" + username + "</Value></Eq></Where></Query>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                p1 = ($(this).attr("ows_Picture"));
                p = "";
                if (p1 == undefined) {
                    var webprotocol = window.location.protocol;
                    var webhost = window.location.host;
                    p = webprotocol +"//" + webhost + "/_layouts/images/person.gif";
                } else {
                    p = p1.split(",")[1];
                }
            });
        }
    });
    return p;
}
then I just add this to <img src='" + getProfPic(user) + "' /> and this is the result

Image

Sir btw I saw your showing spinning icon example I tested it and it worked in Firefox but it doesn't work in IE and chrome. I don't know what's causing this problem.

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>