get new value instead of existing value in text box

get new value instead of existing value in text box

Hi,

I'm trying to validate a newly typed value in the textbox instead of the existing value it has when the page load, unfortunately, whenever I get the .val() I kept getting the existing value in the text box instead of the newly typed value.

How do I get jquery to understand that I want the typed value and not the old value?

My code is this
  1. $('#thetext').val()

found in here

  1. remote:
  2.                     {
  3.                         data: "thetext="+$('#thetext').val(),
  4.                         url: "textchecker",
  5.                         type: "post"
  6.                     }   
thanks