0 Replies - 1018 Views - Last Post: 11 February 2011 - 02:53 PM

#1 init.d.httpd  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 31
  • View blog
  • Posts: 132
  • Joined: 02-February 11

[jQuery] Load another file on click

Posted 11 February 2011 - 02:53 PM

Description: 1.) Create your webpage.( including jQuery of course ) 2. Create the element to attach the click handler to (#loadbutton), and the element that will hold the loaded data 3. Create the file/script to loadLoad another files contents into a particular div on click
//Load up jquery
$(document).ready(function(){

   // Attach the click handler to whatever button
   // will be clicked
   $("#loadbutton").click(function(){

        // specify the element that the data will display in
        // and load the file. Note this will also run
        // whatever file you call, so you can process
        // some server sided action on click :) 
        $("#loadarea").load('/coolscripts/script1.php');
   });
});


Is This A Good Question/Topic? 0
  • +

Page 1 of 1