ziedinjsh Posted July 2, 2011 Report Share Posted July 2, 2011 Sveiki! Šādi notiek textarea informācijas nolasīšana un ievadīšana iekš mysql +/- $(function() { $("#add").click(function() { var nick = $("#nick").val(); var message = $("#message").val(); var dataString = 'nick='+ nick + '&message='+ message; if(nick=='' || message=='') { $('.success').fadeOut(500).hide(); $('.error').fadeOut(500).show(); } else { $.ajax({ type: "POST", url: "add.php", data: dataString, success: function(){ $('.success').fadeIn(500).show(); $('.error').fadeOut(500).hide(); $('#message').val(''); } }); } return false; }); }); kas nepieciešams lai informāciju ievadītu nospiežot ENTER pogu? Quote Link to comment Share on other sites More sharing options...
briedis Posted July 2, 2011 Report Share Posted July 2, 2011 Pievieno textarea eventu $("textarea").keyup(...) un pārbaudi, vai nospiestais taustiņš ir enter. Ja ir enter, izpildi $("#add").click() 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.