I've tried everything (I think) and I still can't figure this out. I have three drop downs. Level One Drop down has two options. Based on the level one drop down, level two drop values changes. Now based on the level two drop down values, I am trying to get level three values using spservices. However it appears when you put the spservices in a change(function), it won't work. What are some other ways to get values for level three using spservices based on the value from the level two drop down? Thank you for your help.

$("#leveltwo").change(function() {

e = document.getElementById("leveltwo");
levelTwoValue = e.options[e.selectedIndex].text;

if (levelTwoValue == "Area")
    var method = "GetListItems";
    var list = "Roster";
    var query = "<Query>" + 
                    "<Where>" +
                        "<Neq>" +
                            "<FieldRef Name='Area'/><Value Type='Text'>asdf</Value>" + 
                         "</Neq>" +
                    "</Where>" +
    var column = "<ViewFields><FieldRef Name='Area'/></ViewFields>";              

    operation: method,
    async: false,
    listName: list, 
    CAMLQuery: query, 
    CAMLViewFields: column,
    completefunc: function(xData, Status) {
    $(xData.responseXML).SPFilterNode("z:row").each(function() {    

    document.write("<option value='" + $(this).attr("ows_Area") + "'>" + $(this).attr("ows_Area") + "</option>");   

  • Did you check the console (f12) for errors? – Akhoy Aug 17 '15 at 2:33
  • Thanks for your response. Yes, I get a "Uncaught TypeError: $(...).SPServices is not a function" – Jae Aug 17 '15 at 2:39
  • I think you don't have the spservices reference set up properly. Have you referenced spservices in your code? Check the general instructions here : spservices.codeplex.com/documentation – Akhoy Aug 17 '15 at 2:45
  • I use getlistitems all the time but whenever I try using it in a change function, it stops working..I call it up top: <script language="javascript" type="text/javascript" src="js/jquery-1.11.2.min.js"></script> <script language="javascript" type="text/javascript" src="js/jquery.SPServices-2014.02.min.js"></script>.. – Jae Aug 17 '15 at 3:25
  • Have you tried using ".on()" instead? – Michael Soriano Aug 21 '15 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.