ajax form handling an array

Posted by moata_u on Stack Overflow See other posts from Stack Overflow or by moata_u
Published on 2012-07-04T08:34:08Z Indexed on 2012/07/04 15:16 UTC
Read the original article Hit count: 126

Filed under:
|
|

am trying to handle an array comes from php file after submitting the form data , the value of data after submitting the form is = ARRAY but i cant use this array in any way , any idea how can i handle this array !!!!

Javascript :

   $('#file').live('change',function(){
       $('#preview').html('');
       $('#preview').html('<img src="loader.gif" />');
       $('#data').ajaxForm(function(data){
               $(data['toshow']).insertBefore('.pic_content').hide().fadeIn(1000);

       }).submit();

  });

PHP :

....
....etc
echo json_encode(array('toshow'=>somedata,'data'=>somedata));

data come from php file

{"toshow":"\r\n\t\t\t\t\r\n\t\t<table class=\"out\">\r\n\t\t\t<tr ><td class=\"img\"><a title=\"2012-06-02 01-22-09\" rel=\"prettyPhoto\" href=\"img\/2012-06-02 01-22-09.284.jpg\"><img  src=\"img\/thumb\/2012-06-02 01-22-09.284.jpg\"\/><\/a><\/td><\/tr>\r\n\t\t\t\r\n\t\t\t<td>\r\n\t\t\t\t<table cellSpacing=\"1\" cellPadding=\"0\">\r\n\t\t\t\t\t<tr><td class=\"data\"><span class=\"click\">2012-06-02 01-22-09<\/span><\/td><\/tr>\r\n\t\t\t\t\t<tr><td class=\"data\"><span class=\"click\">Download<\/span><\/td><\/tr>\r\n\t\t\t\t\t<tr><td class=\"data\"><a href=\"img\/2012-06-02 01-22-09.284.jpg\"><span class=\"click\">View<\/span><\/a><\/td><\/tr>\r\n\t\t\t\t<\/table>\r\n\t\t\t<\/td>\r\n\t\t\t<\/tr>\r\n\t\t<\/table>","span":"<span class='text'><img src='greencheck.png'\/>2012-06-02 01-22-09 Uploaded ,File Size =152Kb <\/span>"}

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript