Use Jquery Selectors on $.AJAX loaded HTML?

前端 未结 9 849
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 11:30

I have

$.ajax({
  url: identity,
  success: function(data) { ProcessIdentityServer(data) }
});

When \'data\' is returned, is there a way to

9条回答
  •  一整个雨季
    2020-11-27 12:29

    You have to define a container first, to be able to get/modify the elements from the response:

     $.ajax({            
         url: url + "/ajax.htm",
         dataType: "html",
         success: function(html) {
             container = $('#ajax_content');
             container.html(html);
             container.find("a").css("background","red");
         }
     });
    

提交回复
热议问题