Javascript method


//////////////////////////////// ajaxFileUpload Method for uploding File ??????????????????????????????????????????
$.ajaxFileUpload
(
{
url:’Ajax/uploadimage.php’,
secureuri:false,
fileElementId:’txtfile’,  // input type = file , name = ‘txtfile’

data:{“albumid”:$(“#id”).val(),”txtimgtitle”:$(“#txtimgtitle”).val()},
success: function (data1, status)
{
                      alert(data1);
                 
},
error: function (data, status, e)
{
alert(e);
}
}
);

//////////////////////////////// LOAD Method ??????????????????????????????????????????

function start()
{
var url = “Ajax/loadpage.php?stext=”+$(“#txtstext”).val().replace(/^\s+|\s+$/g,””).replace(/\s/g,”~@@~”).replace(/&/g,”%26″) + ‘&ddlsschemetype=’+$(‘#ddlsschemetype’).val();
showload(“#loaddata”);
$(“#loaddata”).load(url,{},function (responseText, textStatus, XMLHttpRequest) {

alert(responseText);

});
}
//////////////////////////////// POST Method ??????????????????????????????????????????

$.ajax({
  type: ‘POST’,
  url: “Ajax/delete.php?typ=miniority”,
  data: { ‘name=’+ $(‘#name’).val() + ‘&email=’ + $(‘#email’).val() ; },
  success: function(data12){
//alert(data12);

  }});

Advertisements

$.ajax method ,

function submitform(){var dataString = ‘name=’+ $(‘#name’).val() + ‘&email=’ + $(‘#email’).val() ; alert (dataString); $.ajax({ type: “POST”, // you are also use GET Method url: “http://rajeevphp2011.blogspot.in/”, // get value in this page ex: $_POST[‘name’]; data: dataString, success: function(data1) { // alert(data1); if(data1==’success’) { alert(‘Successfuly send ‘); return false ; } else { alert(‘please try again’); return false ; } } }); return false ; }

Name
Email

function submitform(){
var dataString = ‘name=’+ $(‘#name’).val() + ‘&email=’ + $(‘#email’).val() ; alert (dataString); $.ajax({      type: “POST”, // you are also use GET Method       url: “page.php”, // get value in this page ex: $_POST[‘name’];      data: dataString,      success: function(data1) {  alert(data1);  if(data1==’success’) { alert(‘Successfuly send ‘);   return false ;      } else {    alert(‘please try again’);    return false ;    }    }     });   return false ;   }

  

 

   

   

 

 

   

   

 

 

   

 

Name  
Email

   
          

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