Reputation: 1687
i want to get the number in text field and send it in Url methode GET ;
$(document).ready(function () {
$("#go").click(function() {
var n = document.getElementById('nombre').value;
alert("Chess.php?number=9");
$('#chess').load("Chess.php?number="+n);
});
the value :
<input type="text" name="nombre" id="nombre">
Upvotes: 0
Views: 1291
Reputation: 1687
it works now like this
$(document).ready(function () {
$("#go").click(function() {
$('#chess').load("Chess.php?number="+document.getElementById('nombre').value);
});
});
Upvotes: 0
Reputation: 153
There's a missing }) ...
Plus you have to add in the head section of your script the following :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$("#go").click(function()
{
var n = document.getElementById('nombre').value;
alert("Chess.php?number=9");
$('#chess').load("Chess.php?number="+n);
})
});
</script>
Upvotes: 1
Reputation: 822
Try again with code below:
$(document).ready(function () {
$('#go').click(function() {
$.get('Chess.php', { number: $('#nombre').val() } );
});
});
PS: Its stranger the attribute value called nombre and the field called number. Change this too. Other tip is dont use Uppercase for the url, use only 'chess.php'.
I hope to help you.
Upvotes: 2