well I've never used jQuery on ASP.NET only PHP and now I have this problem because I have an input type button and with jQuery I have a click function but it's not firing. If anyone knows why and how this could be fixed. This is my code:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.js">
$(document).ready(function(e) {
var usuario = $("#tbUsername").text();
var password = $("#tbPassword").text();
var jsonInfo = "usuario:" + usuario + "," + "password:" + password;
$("#btLogin").click(function () {
alert('Click');
});
function _throwError(XMLHttpRequest, textStatus, errorThrown) {
alert("Request: " + XMLHttpRequest.toString() + "Status " + textStatus);
}
function _onSuccess(data, Status, jqXHR) {
if (data == 'authenticated') {
alert('User authenticated');
}
else {
alert('User and password do not match');
}
}
});
</script>
<style type="text/css">
</style>
</asp:Content>
And this is my ASP.NET code, it's all on the client side:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Please login to continue:
</h2>
<table>
<tr>
<td><label>Username: </label></td><td><input id='tbUsername'></td>
</tr>
<tr>
<td><label>Password: </label></td><td><input id='tbPassword'></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Login" id="btLogin"/></td>
</tr>
</table>
<div id="resultado"></div>
<p>
</p>
</asp:Content>
Thanks and regards.