bobdillan_31 Posted July 28, 2014 Share Posted July 28, 2014 Hi ! I am having a heck of a time sending data back in responseText. First of all, I am not actually sure how my data is being sent back into responseText - it is the result of me using a jquery plugin called iframetransport which seeks to transport file inputs across an iframe for ajax like form submission. Anyway, I am echoing back data from PHP like so echo json_encode(array("rowData"=> '<div class = "row" data-id = "'.$row['id'].'" > <div class = "row"><img src="data:image/jpeg;base64,'.base64_encode( $row['blob'] ).'"/></div> <div class = "container"> <div class = "name"><p>'.$row['name'] .'</p></div> </div> </div>')); I know that this data is valid in normal ajax $.posts because I also have form submission without the iframetransport, and it returns the exact same data with no issue. However, when the above data makes its way into responseText it looks like this on the client side: "{"rowData":"\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tasdasd<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t\t1<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>"}" All my divs and elements are replaced with \t or they are not making it into the response. Also when I return blobs like this (this is even worse) I get a 414 (Request-URI Too Large) Any help is appreciated. This is the plugin http://cmlenz.github.io/jquery-iframe-transport/ if interested. Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2014 Share Posted July 28, 2014 Do you have some relevant code? Quote Link to comment Share on other sites More sharing options...
blacknight Posted July 28, 2014 Share Posted July 28, 2014 (edited) i tryed your code i removed all the line brakes from the code and i have this $d = array("rowData"=> '<div class = "row" data-id = "'.$row['id'].'" ><div class = "row"><img src="data:image/jpeg;base64,'.base64_encode( $row['blob'] ).'"/></div><div class = "container"><div class = "name"><p>'.$row['name'] .'</p></div></div></div>'); echo json_encode($d); and the output looks like {"rowData":"<div class = \"row\" data-id = \"test2\" ><div class = \"row\"><img src=\"data:image\/jpeg;base64,ZXRzdDE=\"\/><\/div><div class = \"container\"><div class = \"name\"><p>test3<\/p><\/div><\/div><\/div>"} Edited July 28, 2014 by blacknight Quote Link to comment Share on other sites More sharing options...
mogosselin Posted July 28, 2014 Share Posted July 28, 2014 If it still doesn't work, post more of your code and we'll be able to help you better. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.