jquery教程ajax请求json数据示例

复制代码 代码如下:

$.ajax({
            url: '这个地址要换成你自己的',
            data: {S_CourseID: courseid , CurrTime : new Date().getTime()}, //加个时间戳,否则会不自动更新数据
            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 + ","; //获取JSON对象中的数据

                            coursetypeid = data[i].S_CourseTypeID ;

                        }

                        if (specids.length >0) {

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

                        }

                    }

你可能感兴趣的:(jquery教程ajax请求json数据示例)