Jquery tutorial ajax request json data sample

  • 2020-03-30 01:18:54
  • OfStack


$.ajax({
            url: ' Change this address to your own ',
            data: {S_CourseID: courseid , CurrTime : new Date().getTime()}, //Add a timestamp, otherwise the data will not be automatically updated
            dataType: 'json',
            success: function(data)
            {

                if (data != null) {

                    if ( data.length > 0) {

                         for(var i = 0 ; i < data.length ; i++){

                            specids = specids + data[i].S_SpecialtyID + ","; //Gets the data in the JSON object

                            coursetypeid = data[i].S_CourseTypeID ;

                        }

                        if (specids.length >0) {

                            specids = specids.substring(0,specids.length-1);

                        }

                    }


Related articles: