untuk meload atau menambahkan isi dari suatu halaman lain kedalam halaman kita secara ajax dapat digunakan fungsi load pada jquery
misal kita punya 2 halaman a.php dan b.php
kita akan meload/memasukkan isi halaman b.php kedalam a.php secara ajax
save sebagai a.php
<!DOCTYPE html> <html> <head> <style> body{ font-size: 12px; font-family: Arial; } </style> <script src="../jquery-1.4.1.min.js"></script> </head> <body> <b>Successful Response (should be blank):</b> <div id="success"></div> <b>Error Response:</b> <div id="error"></div> <script> $("#success").load("http://localhost/jquery/load/not-heire.php", function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; $("#error").html(msg + xhr.status + " " + xhr.statusText); } }); </script> </body> </html>
save sebagai b.php
<?php echo "hasil loading"; //echo site_url(); ?>
tinggalkan pesan