ajax calls, events not working.
Hi, I'm new to the forum and have come to my first halt with JQM. I'm trying to make a ajax post to my nodejs Express 3 server. I have two input boxes and submit button. I cant get events to trigger and I have yet to get to see if the post will work. here's my code.
I tried Both
$("#submit").live("click tap", function (event, ui) { alert('hello!!'); });
$(document).ready(function () { $('#submit').click(function () { alert('clicked') $.ajax({ type: 'POST', url: '/login', data: { username: $('#username').val(), password: $('#password').val() }, dataType: "json", success: function (response) { $('#welcomeButton').text('Hi,' + response[0].username); } }); }); });
This is my form:
- a(href="#loginpopup", data-rel="popup", data-role="button",style="font-size:12px;float:right") Login
- div(data-role="popup", id="loginpopup")
- div(data-role="content")
- label(for="username") Username:
- input(type="text", name="username", id="username", value="")
- label(for="password") Password:
- input(type="password", name="password", id="password", value="", autocomplete="off")
- a(id="submit", type="button") Login