downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Giriş> <geoip_time_zone_by_country_and_region
[edit] Last updated: Fri, 23 Mar 2012

view this page in

JavaScript Nesne Bildirimi



add a note add a note User Contributed Notes JSON
manojpali at live dot com 23-May-2012 10:28
var mobile = $('#mobile').val();
 var pwd = $('#pwd').val();

 $.ajax({
        url: logincheck.php',
        type: 'POST',
        dataType: 'json',
        data:({
          mobile : mobile ,
          pwd : pwd
        }),
        error: function(){
        alert('Error loading');
        },
        success: function(data){ if(data.logged_in) {
         // here you can do with your logic .}else{
      // login error :)}}
}

// see the logincheck.php where we send json format data to json header.

$name = "sir";
        $mobile = "9406381901";
        $email = "manoj.pali@georeachonline.com";
        $logged_in= "logged_in";
          
              $data = array( "name" => $name, "mobile" => $mobile, "email" => $email, "logged_in" => $logged_in);
         
        //    header('Content-type: application/json');

        // Return JSON
       
            echo json_encode($data);
jitendra dot thakur2008 at gmail dot com 18-Nov-2011 02:24
JSON is used where we want send data as an object its either be an array or string.
jquery and php json example

var dataString = 'comment=' + comment;
$.ajax({
  type: "POST",
  url: "pagepostbyajax.php",
//this data is mendetory when u want post data when posting page by ajax.
//after that ur data send to that page. now in backend page echo json data.if your //data is in array format the use json_encode() function then echo that json data
//now you find tht json in your success that can you use by taking a loop.
  data: dataString,
  cache: false,
 datatype: json,
  success: function(html){
  $("ul#update").append(datal);

   alert(data);   
  }
 });

Regards Jitendra Thakur

 
show source | credits | sitemap | contact | advertising | mirror sites