I am trying to send a php file to some values using ajax, but in ajax call I get the following error
Uncaught ReferenceError: $ is not defined
at the beginning of the line for the ajax request as follows:
$.ajax({
type: "POST",
url: 'program3.php',
data: {
player1name: player1name.value,
player2name: player2name.value,
playtopoints: playtopoints.value,
delay: delay.value,
numgames: numgames.value,
gamesplayed: gamesplayed.value,
p1turn: p1turn.value,
p2turn: p2turn.value,
p1total: p1total.value,
p2total: p2total.value
},
success: function (data) {
rolling = data;
}
});
At first I thought that refrence for ajax might be needed, so I added the following line before javascript in the html page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
but I still get erro, can anyone offer insight?
I also have all the data variables that are defined as follows:
var player1name = document.JForm.p1name.innerHTML;
Is this the correct way to assign them?
source
share