Hi Everyone, I am new to JQuery, Java Script & Ajax.
Hope you dont mind the daft questions I may post.
Here is my first Jquery, JS & Ajax question.
I have the follow script inside my head section of a website I am testing with.
<script type="text/javascript" src="jquery-1.9.1.js"></script>
<script language="JavaScript" type="text/javascript">
function swapContent(cv) {
$("#inPlayCards").html('<img src="blueloading.gif"/>').show();
var url = "inplaycards-shoot.php";
$.post(url, {contentVar: cv} ,function(data) {
$("#inPlayCards").html(data).show();
});
}
</script>
my button for calling the script is -
<button type="button" class="btn btn-primary btn-large" onClick="return false" onMouseDown="javascript:swapContent('inplaycards');">Click To Select Your Cards</button></p>
On the PHP page I have the following if -
$contentVar = $_POST['contentVar'];
if ($contentVar == "inplaycards") {
mysql db...
}
Now, the above script calls my url, the php page does the mysql query and returns the result in the requested div, no problems there, until I tried adding a second script to the page.
inside the script tags.
function shootone(cv) {
$("#one").html('<img src="blueloading.gif"/>').show();
var url = "inplaycards-shoot1.php";
$.post(url, {contentVar: cv} ,function(data) {
$("#one").html(data).show();
});
}
The button for the second script is
<button type="button" class="btn btn-success btn-large" onClick="return false" onMouseDown="javascript:shootone('shootone');">Click To Select First Card</button></p>
The if statment on my php is
$contentVar = $_POST['contentVar'];
if ($contentVar == "shootone") {
mysql db...
}
Is it possible to have more than one script on a single page, as I need another three to run when I click each individual button.
Any help would be very much appreciated,
Thanks