Not able to pass List Title as a query string from one list to another

Apr 30, 2014 at 12:06 AM
Edited Apr 30, 2014 at 12:08 AM
var queryStringVals = $().SPServices.SPGetQueryString();
    var lastID = queryStringVals["varname"];
    alert(lastID);
var query = "<Query>" +
                    "<Where>" +
                     "<Eq>" + 
                            "<FieldRef Name='Quiz' /><Value Type='Text'>lastID</Value>" +
                        "</Eq>" +


                        "<Neq>" +
                            "<FieldRef Name='ID'/><Value Type='Number'>0</Value>" + 
                        "</Neq>" +
                    "</Where>" +
                    "<OrderBy>" + 
                        "<FieldRef Name='Title'/>" +
                    "</OrderBy>" +
                "</Query>";

not able to get the value of lastID dynamically , hardcoded works

Thanks in Advance
Coordinator
Apr 30, 2014 at 11:43 AM
I think the problem could be several things:

Here you are setting the value of lastID to the query string value for "varname". If you have "?varname=xxx" on the query string that's right, but I'm guessing it's actually "?itemID=xxx"
var queryStringVals = $().SPServices.SPGetQueryString();
var lastID = queryStringVals["varname"];
alert(lastID);
This line means that the query will be for the string "lastID":
"<FieldRef Name='Quiz' /><Value Type='Text'>lastID</Value>" +
It should be:
"<FieldRef Name='Quiz' /><Value Type='Text'>" + lastID + "</Value>" +
Hopefully one of these changes will do it.

M.
Apr 30, 2014 at 5:03 PM
Thanks Marc , it worked