PHP - Remobe <br> From Textareas
What im trying to achieve is not to let the users enter spaces or new lines and send them to database via ajax..
so how can echo a message that the user must enter something when he enters just line breaks or spaces in a textarea? i tried checking if the textarea value is null , = "" or = " " but thats just not what i need... thanks Similar TutorialsHey, I'm looking to see whats the best way of submitting an array of textareas and passing the array via an Ajax request. Basically, I could have a form with 2,4,6 whatever amount of textareas, it's dynamic. When I submit the form I want to get all the values of the textareas and pass through an Ajax request. Here's where I'm at. Code: [Select] // This is a snippet of the code I use, I do a str_replace and put in textareas, but that bits not important $replacements[3] = ' <!--SYSTEM--> <textarea name="free[]" id="free[]" ></textarea> <textarea name="free[]" id="free[]" ></textarea> <!--ENDSYSTEM--> '; // Then my Ajax $(function() { $(".save_newsletter").click(function() { var id = $(this).attr("id"); // I'm stuck here with how I get the array of textarea values and pass to Ajax below. var dataString = 'reply_content='+ val +'&title=' + title; $.ajax({ type: "POST", url: "<?php echo site_url(); ?>newsletter/save_newsletter/"+id, cache: false, data: dataString, success: function(html){ $('#message').append("Saved!"); } }); return false; }); }); |