views:

16

answers:

1

I have an Email Id text box. My requirement is that an user enters some valid Email ID into the Text box and Press Enter key. A status message or an error message should be displayed. I have a button called Send after the Text box. On Click Send button or On ENTER key press(The focus should be on text box not on the Send button) it is going to make an Ajax call.

I have On Success and On Fail methods in that Ajax call. On Success I am going to display a status message saying "Successfully sent message". On Fail I am displaying some other error.

The problem is that I am not able to see any status or error message on my page. Instead the page is getting refreshed. Is it because of the default behavior of the ENTER key press Event ?

+1  A: 

Yes it is bcause of default behaviour. You can return false in your JScript to avoid post back.

Taz