Apply for Zend Framework Certification Training


Question (1)  if the data is send by controller to js using ajax using format json
      then in js how to access array json data 

	$data['state'] = $state;
        $data['city'] = $city;
        $data['streetaddress'] = $streetaddress;
        $data['pincode'] = $pincode;

Answer  (1)

                        type: "POST",
                        dataType: "json",
                        url: baseUrl + 'index/geolocationaccess', 
                        data: JSON.stringify(requestData),
                        success: function(response) {
                            document.getElementById("sel1").value = response.state;
                            document.getElementById("street_add").value = response.streetaddress;
                            document.getElementById("pin_code").value = response.pincode;
                            LAT1 = response.LAT1;
                            LNG1 = response.LNG1;
                            LAT2 = response.LAT2;
                            LNG2 = response.LNG2;

Q no 2   if  Data is returned by Ajax request is  like this (ABOVE)
               "pincode_district":"Mirzapur","pincode_circle_name":"Uttar Pradesh",

Ans To display at front end 

< Display Data Using Php Mysql Jquery in Json Format Access json php jquery arrays objects >

Ask a question

  • Question:
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question

Back to Top