如何使用jquery ajax调用ASP.net来处理原始HTML [Webmethod]

时间:2012-05-03 21:49:17

标签: jquery asp.net ajax

我正在使用以下代码,但在我的web方法中,我将返回纯HTML。内容类型是否就在这里?

 function PopulateTimetable(pGroupId) {
                    $.ajax({
                        type: "POST",
                        cache: false,
                        url: "StudentTimetable.aspx/PopulateTimetable",
                        data: "{ 'pGroupId': '"+51+"'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "html",
                        timeout: 10000,
                        success: function(data) {
                            $("#divTimetable").removeClass("Progress");                        
                            $("#divTimetable").html("").append(data);
                        },
                        error: function() {
                                $("#divTimetable").removeClass("Progress");   
                                alert("An unexpected error has occurred during processing.");
                        }
                    });
                }

1 个答案:

答案 0 :(得分:0)

我在这里$("#divTimetable").html("").append(data.d);使用它现在工作正常