[jQuery] Share my trick to Deserialized the response of JQuery Forms
Hi All
I am working in Jquery Forms
<a href="http://malsup.com/jquery/form/#getting-started">http://malsup.com/jquery/form/#getting-started</a>
I would like to share a tip/trick
in the your php file create a output like this
echo '<div id="' .$id .'" title="' .$title .'" image="' .$thumbs .'"></div>';
to deserialized the response
$(document).ready(function() {
$('#myForm').ajaxForm({
beforeSubmit:
validate,
success:
function(data) {
$('#myid ').append('<a href="/' + $(data).attr("id") + '">my response</a>');
}
});
So What I did is get with $(data).attr("id") the value of $id
You can create how many itens you need in your php file and deserialized the response
$(data).attr("title")
$(data).attr("image")
you can use xml, json but I think text is fast.
Hope be useful
Regards
Mario Moura
macm