Any ideas what may be causing this?
This code runs fine in Chrome.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><!-- load jquery -->
<script type="text/javascript">
//start of jQuery document ready section
function checkListItems(region, time)
{//start of function
var basePath = "https://sp.test.com/sp/ts/"; //This is your base site url with "/_api/" appended to the end
var listName = "CharlesSchwabMeetingsShane"; //This is where you put the name of your picture library
//start of Ajax query
jQuery.ajax({
//
//This is where you add the fields you would like to return after the "select=". Separate fields by a ","
url: basePath + "_vti_bin/listdata.svc/"+listName+"?$select=Name,Time1,Region1,IndividualMeetings&$expand=Region1,Time1,IndividualMeetings",
//
type: "GET", //This is set to GET so it can pull the data properly
headers: { "Accept": "application/json;odata=verbose" }, //This just sets the data to be returned as json data
success: function (data) //data is a system variable which contains the data returned from the server
{
jQuery.each(data.d.results, function (index, value)
//index is the index of items
//value is the item being receieved
//data.d is the serialized data value from the query, and adding .results to the end gets the results of the serialized data
{
if(value.Region1.Id == region && value.Time1.Id == time)
{
//console.log(value.IndividualMeetings); -Show just the object details in the console
$("#ctl00_m_g_840c396b_fbc8_44f2_ba14_0aef5e4d34f0_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_DropDownChoice option[value='"+value.IndividualMeetings.Value.toString()+"']").hide();
//$("#select1 option:contains(Text)").remove(); -Alternative removal method
}
});
},
error: function (data)
{
//Error gets output here
alert(data.statusText); //data.statusText displays the status of the call
},
complete: function()
{
//Insert any code here that you want to run when the ajax call has completed
}
});//End of Ajax query
}//end of function
$(document).ready(function() {
alert("test");
//Listen for changes to time drop down start
$('#ctl00_m_g_840c396b_fbc8_44f2_ba14_0aef5e4d34f0_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_Lookup').change(function() {
selectedRegion = document.getElementById('ctl00_m_g_840c396b_fbc8_44f2_ba14_0aef5e4d34f0_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_Lookup').value; //Gets the Region1 value
selectedTimeId = $(this).val(); //This gets the value of the drop down that we are listening for (Time1)
$("#ctl00_m_g_840c396b_fbc8_44f2_ba14_0aef5e4d34f0_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_DropDownChoice").children('option').show(); //Resets so all corresponding times show
checkListItems(selectedRegion,selectedTimeId); //Call ajax call to check list entries
});
//Listen for changes to time drop down end
});</script>