php - Need help on using React with json data -


i want work backend system can pull data use react put on screen updating virtual dom.

using form , setting state form variable, made string passing php page

var datastring = 'name='+ this.state.name +'&email='+ this.state.email +'&dob='+ this.state.dob +'&mobile= '+this.state.number;  $.ajax({ url: "http://localhost/reactjs/api/readformdata.php", type : "post", data : datastring, cache: false, success: function(html){                                                                      alert(html); this.setstate({serverresponce: html}); }, });`   `<?php if(count($_post)>0){ $email = $_post['email']; $name = $_post['name']; $dob = $_post['dob']; $mobile = $_post['mobile']; $value = [ "name" => "{$name}", "email" => "{$email}", "dob"=> "{$dob}", "mobile"=>"{$mobile}" ]; echo json_encode((array)$value); }else{ echo"error"; } ?> 

as shown in figure getting data unable use data in application. need suggestions , help.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -