how to use .load() function

how to use .load function jquery ,. load() function is very simple , load() function is combination of AJAX and JQUERY

function changeinfo(){var uid = $(‘#selectid’).val();$(‘#loaddata’).load(‘loadinformation.php?uid=’+uid);$(‘#user1’).hide();$(‘#user2’).hide();$(‘#user3’).hide();$(‘#user4’).hide();$(‘#user’+uid).show();}
Select User : select User user 1 user 2 user 3 user 4

for this example create two page  and load one page into anothe page

for example we create two page  information.php   and  second   loadinformation.php 

first page in information.php   when you select use them you show user details

information.php

function changeinfo(){
var uid = $(‘#selectid’).val();
$(‘#loaddata’).load(‘loadinformation.php?uid=’+uid);

}

Select User :
user 1
user 2
user 3
user 4






loadinformation.php

<?php
$con = mysql_connect(“localhost” , “root” ,””);
mysql_select_db(“databasename”,$con);
$uid = $_GET[‘uid’];
$query = mysql_query(“SELECT * FROM tablename WHERE uid = ‘” . $uid . “‘”,$con);
$row = mysql_fetch_array($query) ;

echo “User Name :” . $row[‘username’] . “
” ;
echo “city Name :” . $row[‘cityname’] . “
” ;
echo “Address :” . $row[‘address’] . “
” ;
?>

when you select user them we are load  another page and get user information from database and show on loaddata  div

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s