Load website into DIV

前端 未结 5 2118
我在风中等你
我在风中等你 2020-11-28 15:12

how do i actually retrieve data from a website when i write the URL in a textbox and then hit the submit button. I want the data to be put in an div that i have. Is this pos

5条回答
  •  难免孤独
    2020-11-28 15:41

    It's right, the browsers not allow AJAX request to others domain sites, I had the same problem and did the workmad3's tip, something like this:

    $(document).ready(function(){
         $('#url').change(function(){
              var _url=$(this).val();
              $('#webDisplay').attr('src',_url);
         });
    });
    

    where my url ID is a INPUT text, very nice trick

提交回复
热议问题