1

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>
  • Change jQuery version to 1.12.4 and check. Afaik,version 3.xx doesn't work on ie8 – Gautam Sheth Sep 6 '17 at 18:42
  • @GautamSheth That didn't resolve the issue, if I go to IE 10/11 it works though aside from the .change() function in the javascript call. – The Inexperienced Gamer Sep 6 '17 at 18:54
  • @GautamSheth The issue was using the min version of jquery 3.2.1. Once I used the full version it worked just fine. – The Inexperienced Gamer Sep 6 '17 at 19:41
1

The issue was using the min version of jquery 3.2.1. Once I used the full version it worked just fine.

Also to hide or show select options I had to use the attr/removeattr feature.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.