allright, so with this funtion what happens is that the content of the input gets posted on div with a "ul" in it . the only thing is that is actually posting everything, even when it has nothing, it posts the blank value.
How could i make it NOT post anything if the input value is blank ? ...
I tried to add an iff , but its not working... =[
any Guidance pls?
postbar_add_post = form name
addcontentbox = text input name
or ... should I try from the php file ? ...
Any sugestions/helps/guidance/ideas are kindly appretiated
How could i make it NOT post anything if the input value is blank ? ...
I tried to add an iff , but its not working... =[
any Guidance pls?
Code:
<script type="text/javascript"> $(document).ready(function(){ $("form#postbar_add_post").submit(function() { var addcontentbox = $('#addcontentbox').attr('value'); $.ajax({ type: "POST", url: "postear.php", data:"addcontentbox="+ addcontentbox, success: function(){ $("ul#wall").prepend("<li>"+addcontentbox+"</li>"); $("ul#wall li:first").fadeIn(); document.postbar_add_post.addcontentbox.value=''; } }); return false; }); }); </script>
addcontentbox = text input name
or ... should I try from the php file ? ...
Any sugestions/helps/guidance/ideas are kindly appretiated
Comment