Search Results

Search found 1 results on 1 pages for 'user1772630'.

Page 1/1 | 1 

  • what this json must work?

    - by user1772630
    hi i search alot for get a respone from php back and if that respone is ok do someting and if its false do something else(!!!!!!!! WHENE I HAVE OTHER OUTPUT FROM THAT PHP !!!!!!) this is my index file <head> <script src="jquery-1.7.2.js" type="text/javascript"></script> <script src="js.js" type="text/javascript"></script> </head> <body> <p> click </p> <input type="text" id="who"> <br> <input type="text" id="why"> <div id="bg" align="center"> </div> </body> this is my JS file $(document).ready(function(){ $('p').click(function(){ var who = $('input#who').val(); var why = $('input#why').val(); $.post('file.php',{who:who,why:why},function(data) { if(data.success){ alert(data.message); } else{ alert('ERROR:' + data.message); } }); }); }); and this is my file.php <?php $response = array('success' => 'true', 'code' => "jQuery('#bg').html('\"Javascript\", \"json\", \"PHP\"');"); echo json_encode($response); ?> my question : 1- why this is not work i get alert (error:undifined) 2- how i can get some result from that php file when its have other output like this: <?php echo "1"; echo "2"; echo "3"; and now echo that json ?> thanks :(

    Read the article

1