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 

< Order multiple columns in Zend Framework1 api data to accesss element retrieved in json_decode format in php >

Ask a question

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

Back to Top