php - prolem in getting particular value from json string -
i want first element of json. data.first getting nothing.although alert(data) print total json string please help me out of this
<?php include_once '../con_db.php'; $rf = $_post['rf']; $rid = $_post['tid']; $data = array("first" => "one","seconed"=> "two"); echo json_encode($data); ?>
jquery code ajax request below
$('.fbased').focusin(function(){ var rf = $(this).attr('id'); var tid = $("#test_id").val(); $.ajax({ type:'post', url:'functions/ftable.php', data: 'rf='+rf+'&tid='+tid, datatype: "json", success : function(data){ $("#"+rf).val(data); } }); });
success : function(data){ var parsed = json.parse(data); $("#"+rf).val(parsed.first); }
php jquery json
No comments:
Post a Comment