Get HTML source code as a string

前端 未结 5 1422
悲&欢浪女
悲&欢浪女 2021-02-07 19:25

I want the source code of an HTML page (1.html) to be used in another page (2.html). Furthermore, I want to perform operations on it in 2.html

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-07 19:38

    I don't understand whatyou mean that you must make modifications, but you could simply load the second page through AJAX

    var url ="1.html";
    $.ajax({
      url: url,
      dataType: 'html'
      success: function(data){
                 //do something with data, which is the page 1.html
               }
    
    });
    

提交回复
热议问题