javascript - unexpected non-whitespace character after JSON data at line 1 column 991 -


i have wordpress site locally , trying build it's hybrid app using angularjs.

in wordpress, created plugin fetch data. metadata in form of array as

array ( [real_homes_gallery_slider_type] => array     (         [0] => thumb-on-right     )  [real_homes_property_images] => array     (         [0] => 94     )  [real_homes_property_price] => array     (         [0] => 3850     )  [real_homes_property_size] => array     (         [0] => 2800     )  [real_homes_property_bedrooms] => array     (         [0] => 2     )  [real_homes_property_bathrooms] => array     (         [0] => 1     )  [real_homes_property_garage] => array     (         [0] => 1     )  [real_homes_property_address] => array     (         [0] => athwa gate, surat, gujarat 395008, india     )  [real_homes_property_location] => array     (         [0] => 21.1852392,72.80947859999992     )  [real_homes_tour_video_url] => array     (         [0] => http://vimeo.com/70301553     )  [real_homes_featured] => array     (         [0] => 1     )  [real_homes_add_in_slider] => array     (         [0] => no     )  [real_homes_agents] => array     (         [0] => 110     )  [_dp_original] => array     (         [0] => 75     )  [real_homes_property_price_postfix] => array     (         [0] => per month     )  [_wp_old_slug] => array     (         [0] => 15421-southwest-39th-terrace-fl     )  [real_homes_tour_video_image] => array     (         [0] => 94     )  [real_homes_property_id] => array     (         [0] => aagam003     )  [real_homes_property_size_postfix] => array     (         [0] => sq ft     )  [slide_template] => array     (         [0] => default     )  [real_homes_agent_display_option] => array     (         [0] => agent_info     )  [_edit_lock] => array     (         [0] => 1436890564:1     )  [_edit_last] => array     (         [0] => 1     )  [_thumbnail_id] => array     (         [0] => 894     )  [real_homes_slider_image] => array     (         [0] => 841     )  ) 

so converted simple array , got bellow array.

array ( [real_homes_gallery_slider_type] => thumb-on-right [real_homes_property_images] => 94 [real_homes_property_price] => 3850 [real_homes_property_size] => 2800 [real_homes_property_bedrooms] => 2 [real_homes_property_bathrooms] => 1 [real_homes_property_garage] => 1 [real_homes_property_address] => athwa gate, surat, gujarat 395008, india [real_homes_property_location] => 21.1852392,72.80947859999992 [real_homes_tour_video_url] => http://vimeo.com/70301553 [real_homes_featured] => 1 [real_homes_add_in_slider] => no [real_homes_agents] => 110 [_dp_original] => 75 [real_homes_property_price_postfix] => per month [_wp_old_slug] => 15421-southwest-39th-terrace-fl [real_homes_tour_video_image] => 94 [real_homes_property_id] => aagam003 [real_homes_property_size_postfix] => sq ft [slide_template] => default [real_homes_agent_display_option] => agent_info [_edit_lock] => 1436890564:1 [_edit_last] => 1 [_thumbnail_id] => 894 [real_homes_slider_image] => 841 ) 

ihen encoded array json using php.

json_encode($result); 

$result resultant array

i called ajax request using angularjs , response gave me result below.

{"real_homes_gallery_slider_type":"thumb-on-right","real_homes_property_images":"94","real_homes_property_price":"3850","real_homes_property_size":"2800","real_homes_property_bedrooms":"2","real_homes_property_bathrooms":"1","real_homes_property_garage":"1","real_homes_property_address":"athwa gate, surat, gujarat 395008, india","real_homes_property_location":"21.1852392,72.80947859999992","real_homes_tour_video_url":"http:\/\/vimeo.com\/70301553","real_homes_featured":"1","real_homes_add_in_slider":"no","real_homes_agents":"110","_dp_original":"75","real_homes_property_price_postfix":"per month","_wp_old_slug":"15421-southwest-39th-terrace-fl","real_homes_tour_video_image":"94","real_homes_property_id":"aagam003","real_homes_property_size_postfix":"sq ft","slide_template":"default","real_homes_agent_display_option":"agent_info","_edit_lock":"1436890564:1","_edit_last":"1","_thumbnail_id":"894","real_homes_slider_image":"841"}0 

i dont know why there 0 @ end if had not appended response. guess result json string tried converting json object use , fetch data keys. have other json responses in [] brackets. 1 not, may due 0 @ end of json string response.

please me out. thanks.

this thing wordpress , ajax system. if @ file wp-admin/admin-ajax.php, @ end of file there's die(0) statement culprit.

in order statement not run, need add wp_die(); statement after output json string (this in wordpress documentation on ajax requests).


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -