Hi Friends , am newbie to ajax. For example just consider one account registration -
A form contains 8 text fields with submit button. In this form second texbox contains "username " . On right side of text box there is a label box . On clilck action i need to determine user is available or not. Is it possible on clicking label or should i click
If I'm understanding it right, then its not very tough to do. On the onclick event of the checkbox, you need to check the value property of the textbox using its ID. Like if the username textbox has the ID user_name, then the onclick even will just check
I still can't understand what you want to do. You want to send an Ajax request, now whether you send it on click of a checkbox or a button depends upon what you want to do. submit button by default posts back the page instead of making an Ajax call. What exactly do you want to do is not clear...
Joined: Sep 10, 2009
can i send a request to server on clicking check box. is it possible
1. On click event of labels call a java script function
2. In that java script function, create an XMLHttpRequest object
3. Create a post string that needs to send to servlet calss. In your case "user name"
4. By using XMLHttpRequest object's 'open','setRequestHeader','send' methods send the request to the servlet
5. Do your business logic in servlet and send the output to java script by write/print/JSON techniques.(in your case 'true/false' or exists/available)
6. In java script check for readyState(ie readyState ==4) then use XMLHttpRequest object.responseText to get the result that sent from servlet.