简体   繁体   中英

reloading page content with <select> php ajax

here is my code...

<select id="load">
<option value="page1.php"></option>
<option value="page2.php"></option>
<option value="page3.php"></option>
</select>
<div id="content"</div>

i want to load these page1.php, page2.php and page3.php via jquery ajax and php in content div...

$('select#load').change(function() {
  $.ajax({
    type: "GET",
    url: this.value,
    success: function(result) {
      $('#content').html(result);
    }
  });
})

如果您不想使用jQuery或Ajax,则可以使用iframe,只需更改src属性即可。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM