The users type the data required and then I want to fetch that data using jQuery when they click the submit button. The data will be sent via AJAX to a PHP script for analysis (for spam, banned words, etc). How do I fetch the data from the textarea/textbox?
You can use the .val() function in jQuery to fetch the value. This will fetch the current value using your example:
$("#data").val()
Assign that value to a variable or pass it directly to the AJAX script you mentioned. You can also set the value of the textbox (IE: if the AJAX script reports spam) to be nothing or anything by entering a string in the .val():
$("#data").val("enter anything here");
You can use the [b].val()[/b] function in jQuery to fetch the value. This will fetch the current value using your example:
[code=javascript]$("#data").val()[/code]
Assign that value to a variable or pass it directly to the AJAX script you mentioned. You can also set the value of the textbox (IE: if the AJAX script reports spam) to be nothing or anything by entering a string in the .val():
[code=javascript]$("#data").val("enter anything here");[/code]
robertman11
Assign that value to a variable or pass it directly to the AJAX script you mentioned. You can also set the value of the textbox (IE: if the AJAX script reports spam) to be nothing or anything by entering a string in the .val():
You can use the [b].val()[/b] function in jQuery to fetch the value. This will fetch the current value using your example: [code=javascript]$("#data").val()[/code] Assign that value to a variable or pass it directly to the AJAX script you mentioned. You can also set the value of the textbox (IE: if the AJAX script reports spam) to be nothing or anything by entering a string in the .val(): [code=javascript]$("#data").val("enter anything here");[/code]
Are you sure you want to delete this post?