Node.js res.send is not working
===

In my index.js, I  have an exports function that is supposed to send data back to the client via ajax on pressing a submit button.  However, when the user presses submit, the data seems to get sent over before it the data gets modified.  When pressing submit one more time, it sends the data that was previously modified as if clicking the submit button only sends the 'previously' set data.  This is my code:

            var tabledata = getRecordFromDatabase(key);
			if(tabledata.length === 0)
				tabledata = 'There is no matched record in the database';
			res.contentType('text/html');
			res.send({'matched':tabledata});

So to illustrate the error:  I click submit after filling out a form and receive back the message "There is no matched record in the database".  I hit submit a second time without changing anything in the form I just filled.  This time record data is actually sent to me.  Why could this be?