I have two lists one for "States" and another for "Cities". I referred this solution - http://www.markrackley.net/2014/05/20/cascading-drop-down-lists-in-sharepoint-office-365-using-rest/ and I did same as described there but I got this error -
Pls give me some solution. My Code is:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.01/jquery.SPServices.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
HillbillyCascade({
parentFormField: "State", //Display name on form of field from parent list
childList: "Cities", //List name of child list
childLookupField: "Title", //Internal field name in Child List used in lookup
childFormField: "City", //Display name on form of the child field
parentFieldInChildList: "State" //Internal field name in Child List of the parent field
});
});
function HillbillyCascade(params)
{
var parent = $("select[Title='"+params.parentFormField+"'], select[Title='"+
params.parentFormField+" Required Field']");
$(parent).change(function(){
DoHillbillyCascade(this.value,params);
});
var currentParent = $(parent).val();
if (currentParent != 0)
{
DoHillbillyCascade(currentParent,params);
}
}
function DoHillbillyCascade(parentID,params)
{
var child = $("select[Title='"+params.childFormField+"'], select[Title='"+
params.childFormField+" Required Field']," +
"select[Title='"+params.childFormField+" possible values']");
$(child).empty();
var options = "";
var call = $.ajax({
url: "http://sp2010dev:1234/_vti_bin/listdata.svc/"+params.childList+
"?$select=Id,"+params.childLookupField+","+params.parentFieldInChildList+
"Id&$filter=("+params.parentFieldInChildList+
"Id eq "+ parentID + ")",
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR){
for (index in data.d.results)
{
options += "<option value='"+ data.d.results[index].Id +"'>"+
data.d.results[index][params.childLookupField]+"</option>";
}
$(child).append(options);
});
call.fail(function (jqXHR,textStatus,errorThrown){
alert("Error retrieving information from list: " + params.childList + jqXHR.responseText);
$(child).append(options);
});
}
</script>
I have three lists. First is "States", having one column "Title". Second list's name is "Cities" and it has two columns one is "Title" and other is "State" which is a lookup with States list. Now, third list's name is "Cascade", having three columns "Title", "State" which is lookup with States list and last column name is "City" Which is lookup with "Cities" list's "Title" Column.
I don't understand where I did mistake.
Pls guide me.