solon Posted November 3, 2008 Share Posted November 3, 2008 Hey guys i have two Ajax scripts in the same page! The first one works perfectly the second does not give a response ! Here is the script: <script> var xmlHttp function get_total() { /** *check browser for the correct xmlHttp request */ var http; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari http = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } /** *the url is the ajax page to be called in this case page.php *params are the values that are going to be send */ var url='amount_check.php'; //get the value of the stake input element var stake=document.getElementById('stake').value; //get the value of the poss_win input element var session=document.getElementById('session').value; var params = 'stake='+stake+'&session='+session; http.open("POST",url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function(){ if(http.readyState == 4){ document.getElementById("poss_win").innerHTML=http.responseText; } } http.send(params); } </script> <script> var xmlHttp function check_games() { /** *check browser for the correct xmlHttp request */ var http1; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari http1 = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ http1 = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ http1 = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } /** *the url is the ajax page to be called in this case page.php *params are the values that are going to be send */ var url='bet_check.php'; //get the value of the stake input element var session=document.getElementById('session').value; var params = 'session='+session; http1.open("POST",url, true); http1.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http1.setRequestHeader("Content-length", params.length); http1.setRequestHeader("Connection", "close"); http1.onreadystatechange = function(){ if(http1.readyState == 4){ document.getElementById("bet_state").innerHTML=http1.responseText; } } http1.send(params); } </script> I would be thankful for any advice! Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 you can't share the same xmlHttp object. you can try renaming them to xmlHttp1 and xmlHttp2. but, if you want to make your life easier, start using a JavaScript library like jQuery, Mootools, Prototype, etc (jQuery is my personal favorite). Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 I dont yet know what those libraries are but thanks for the advice! Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 just a for example...this: <script> var xmlHttp function get_total() { /** *check browser for the correct xmlHttp request */ var http; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari http = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } /** *the url is the ajax page to be called in this case page.php *params are the values that are going to be send */ var url='amount_check.php'; //get the value of the stake input element var stake=document.getElementById('stake').value; //get the value of the poss_win input element var session=document.getElementById('session').value; var params = 'stake='+stake+'&session='+session; http.open("POST",url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function(){ if(http.readyState == 4){ document.getElementById("poss_win").innerHTML=http.responseText; } } http.send(params); } </script> would be replaced with: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function get_total() { $('#poss_win').load('amount_check.php',{ 'stake' : $('#stake').val(), 'session': $('#session').val() }); } </script> Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 thanks again , and on that i have another question. Using this is it possible to have two functions in the same script-page? Something like the following?: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function get_total() { $('#poss_win').load('amount_check.php',{ 'stake' : $('#stake').val(), 'session': $('#session').val() }); } function check_games() { $('#bet_state').load('bet_check.php',{ 'session': $('#session').val() }); } </script> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 yup Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 i do that and whilst the first function works perfect;y the second does not give any response back! what might be the problem? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 i don't see any problems with it. can you post the code for the entire page? Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function get_total() { $('#poss_win').load('amount_check.php',{ 'stake' : $('#stake').val(), 'session': $('#session').val() }); } function check_games() { $('#bet_state').load('bet_check.php',{ 'session': $('#session').val() }); } </script> <?php ob_start();?> <?php include("config.php"); session_start(); $session_id = session_id(); if(isset($_SESSION['SESS_MEMBER_ID'])) { echo "<table cellspacing='2' width='380' bgcolor='#333333' border='0'><tr><td><b>Agent's Name:</b></td><td> ".$_SESSION['SESS_AFIRST_NAME']." ".$_SESSION['SESS_ALAST_NAME']."</td></tr>"; echo "<tr><td><b>Member's Name:</b></td><td> ".$_SESSION['SESS_MFIRST_NAME']." ".$_SESSION['SESS_MLAST_NAME']."</td></tr>"; echo "<tr><td><b>Address: </b></td><td>".$_SESSION['SESS_ADDRESS']."</td></tr>"; echo "<tr><td><b>E-Mail:</b></td><td> ".$_SESSION['SESS_EMAIL']."</td></tr>"; echo "<tr><td><b>City:</b></td><td> ".$_SESSION['SESS_CITY']."</td></tr>"; echo "<tr><td><b>Country:</b> </td><td>".$_SESSION['SESS_COUNTRY']."</td></tr> "; echo "<tr><td><b>Mobile:</b></td><td> ".$_SESSION['SESS_PHONE']."</td></tr>"; echo "<tr><td><b>Id No:</b></td><td> ".$_SESSION['SESS_IDEN']."</td></tr><tr><td></td></tr>"; } else if(isset($_SESSION['SESS_AGENT_ID'])) { echo "Agent's Name: ".$_SESSION['SESS_AFIRST_NAME']." ".$_SESSION['SESS_ALAST_NAME']." "; } else if(!isset($_SESSION['SESS_AGENT_ID'])) { echo "You are NOT logged in"; echo' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>K-ebet : The online betting site...</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="default.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper">'; exit(); } ?> <?php echo" <table cellspacing='2' width='380' bgcolor='#333333' border='0' > <tr> <td width='260'><u><b> Game </b></u></td> <td width='150' align='left'><u><b> Bet </b></u></div></td> <td width='40'><div align='center'><u><b> Winings </b></u></div></td> </tr><tr>"; ?> <?php //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Output query $bets = $_POST['bets2']; //echo "<td><input type='text' name='bets' value='".$bets."' onchange= /></td>"; $total =1; $bets = $_POST['bets']; $result = mysql_query("SELECT * FROM `coupons` WHERE `session_id` = '$session_id' && `confirmed` = ''"); if ($result >= 1) { while($row = mysql_fetch_array($result)) { echo "<form action='remove_bet.php' method='post'><tr> <input type='hidden' name='event1' value='$row[event]'/> <td><input type='hidden' value='$row[event]'/>$row[event]</td> <td>$row[bet]</td> <td align='right'>$row[winings]</td> <td><input type='submit' value='X' class='remove' /><input type='hidden' name='game_id' id='game_id' value='$row[game_id]' /></td> </tr></td></tr></form>"; $total *= $row[winings]; } $all_total = number_format($total, 2, '.', ''); echo"<tr><td><span id=\"bet_state\"></span></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td><tr><td></td><td><b>Total:</b></td><td align='right'>".$all_total."</td></tr>"; echo"<td></td><td align='left'><b>Bet Stake:</b></td> <td align='left'> <form name='amount' id='amount' method='post'> <input type='text' name='stake' id='stake' size='10' value='1' autocomplete='off' onkeyup='get_total()' /> <input type='hidden' name='event1' value='$row[event]'/> </td></tr> <tr><td></td><td><b>Possible Winnings:</b></td><td><span id='poss_win'></span> <input type='hidden' name='session' id=\"session\" value='$session_id' /> <input type='hidden' name='total' id='total' value='$all_total' />"; echo"<tr><td><input type='submit' value='Continue>>' onClick=\"check_games()\" class='remove' /> </form></td></tr>"; } else { echo "asd"; } ?> </table> <?php ob_flush(); ?> <style> .remove { background-color:#333333; border-style:none; border-color:#333333; cursor:pointer; color:#FFFFFF; } </style> And i use in bet_check.php: $sess = $_POST['session']; echo $sess; And i get no result and using firebug it gives me a red colored line and an (X). Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 And i get no result and using firebug it gives me a red colored line and an (X). That should mean it can't find the file. Are you sure the filename is spelled correctly? If you right click on the red line and say "Open in new tab", does it open the file? Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 yes it does but the weird thing is that given that if i click on POST tab i get the value posted when it opens in the new tab it doesn't show anything! If i write something like: <?php echo "test"; ?> in the bet_check.php i get it on "open in new tab but not as a response so it can be written in my <span> </span> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 on your page with all the HTML/JavaScript...can you post the "generated" source? the php, etc is meaningless to me cus i don't have any of the database info it's using to generate. so just do a View Source and copy/paste that. Then I can load that up and debug it better Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href='default.css' rel='stylesheet' type='text/css' /> </head> <body> <script type="text/javascript"> // Current Server Time script (SSI or PHP)- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use. //Depending on whether your page supports SSI (.shtml) or PHP (.php), UNCOMMENT the line below your page supports and COMMENT the one it does not: //Default is that SSI method is uncommented, and PHP is commented: //var currenttime = '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' //SSI method of getting server date var currenttime = 'November 03, 2008 21:58:34' //PHP method of getting server date ///////////Stop editting here///////////////////////////////// var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var serverdate=new Date(currenttime) function padlength(what){ var output=(what.toString().length==1)? "0"+what : what return output } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) document.getElementById("servertime").innerHTML=datestring+" "+timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script> <div id="menu" align="right"> <ul> <li><a href="index1.php">Home</a></li> <li><a href="register.php">Register</a></li> <li><a href="contact.php">Contact</a></li> <!--<li><a href="live_scores.php">Live Scores</a></li>--> </ul> </div> <hr/> <div id="page"> <table> <tr> <td valign="top"> <div id="sidebar"> <style type="text/css"> <!-- .style1 {color: #FFFFFF} .style2 {color: #000000; } --> </style> <ul> <li> <h2><a href="register.php">Register a user</a> | <a href="update_agent.php">Agent Details</a></h2> <ul class="list"> </ul> </li> <li> <h2>Categories</h2> <ul class="list"> <li><a href="lottery.php">K-Lottery</a></li> <li><a href="k_8.php">K-8 numbers</a></li> <li><a href="lucky_numbers.php" >K-Lucky numbers</a></li> <li><a href="game-show.php">K-Football</a></li> <li><a href="dogs.php">K-Dogs</a></li> <li><a href="tennis.php">K-Tennis</a></li> <li><a href="futsal.php">K-Futsal</a></li> <li><a href="political.php">K-Political</a></li> <li><a href="eurovision.php">K-Eurovision</a></li> <li><a href="pool.php">K-Pool</a></li> <li><a href="rally.php">K-Rally</a></li> <li><a href="formula.php">K-Formula 1</a></li> <li><a href="golf.php">K-Golf</a></li> <li><a href="volley.php">K-Volley</a></li> <li><a href="basket.php">K-Basketball</a></li> <li><a href="stock_ex.php">K-Stock Exchange</a></li> <li><a href="bet_history.php">Betting History</a></li> <li class="style1"><a href="/admin" class="style1">ADMIN</a></li> </ul> </div> </td> <td valign="top"> <div id="content"> <h1> Available Games!</h1> <div align="left"> <table width='570' border='0' align='center'> <tr> <td><strong>Time</strong></td> <td align ='center'><strong>1</strong></td> <td><strong>Home Team </strong></td> <td align ='center'><strong>X</strong></td> <td><strong>Away Team </strong></td> <td align ='center'><strong>2</strong></td> <td><strong>Specials</strong></td> </tr> <tr bgcolor='#CCCCCC'><td bgcolor='#CCCCCC' colspan='7'></td> </tr> <tr><td colspan='4'></td></tr><tr><td colspan='4'><u><b>03.11.08</td></tr></b></u><tr><td colspan='4'></td></tr> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.65'/> <input type='hidden' id='bet' name='bet' value='River Plate'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='1.65' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='39'/> </td> </form> <td>River Plate</td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.20'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='3.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='39'/> </td> </form> <td> Chivas</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='5.20'/> <input type='hidden' id='bet' name='bet' value=' Chivas'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='5.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='39'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='39'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='2.10'/> <input type='hidden' id='bet' name='bet' value='Internacional'/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='2.10' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='40'/> </td> </form> <td>Internacional</td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.10'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='3.10' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='40'/> </td> </form> <td> Boca Juniors</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.20'/> <input type='hidden' id='bet' name='bet' value=' Boca Juniors'/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='3.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='40'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='40'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.35'/> <input type='hidden' id='bet' name='bet' value='Palmeiras'/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='1.35' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='41'/> </td> </form> <td>Palmeiras</td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='4.00'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='4.00' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='41'/> </td> </form> <td> Argentinos Jrs</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='8.00'/> <input type='hidden' id='bet' name='bet' value=' Argentinos Jrs'/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='8.00' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='41'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='41'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='2.50'/> <input type='hidden' id='bet' name='bet' value='America Rn '/> <input type='hidden' id='event' name='event' value='America Rn - Santo Andre'/> <input type='submit' class='remove' value='2.50' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='69'/> </td> </form> <td>America Rn </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.20'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='America Rn - Santo Andre'/> <input type='submit' class='remove' value='3.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='69'/> </td> </form> <td> Santo Andre</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='2.50'/> <input type='hidden' id='bet' name='bet' value=' Santo Andre'/> <input type='hidden' id='event' name='event' value='America Rn - Santo Andre'/> <input type='submit' class='remove' value='2.50' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='69'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='69'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.60'/> <input type='hidden' id='bet' name='bet' value='Bragantino '/> <input type='hidden' id='event' name='event' value='Bragantino - Abc Natal'/> <input type='submit' class='remove' value='1.60' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='70'/> </td> </form> <td>Bragantino </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.50'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Bragantino - Abc Natal'/> <input type='submit' class='remove' value='3.50' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='70'/> </td> </form> <td> Abc Natal</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='4.90'/> <input type='hidden' id='bet' name='bet' value=' Abc Natal'/> <input type='hidden' id='event' name='event' value='Bragantino - Abc Natal'/> <input type='submit' class='remove' value='4.90' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='70'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='70'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.60'/> <input type='hidden' id='bet' name='bet' value='Brasiliense '/> <input type='hidden' id='event' name='event' value='Brasiliense - Criciuma'/> <input type='submit' class='remove' value='1.60' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='71'/> </td> </form> <td>Brasiliense </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.50'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Brasiliense - Criciuma'/> <input type='submit' class='remove' value='3.50' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='71'/> </td> </form> <td> Criciuma</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='4.90'/> <input type='hidden' id='bet' name='bet' value=' Criciuma'/> <input type='hidden' id='event' name='event' value='Brasiliense - Criciuma'/> <input type='submit' class='remove' value='4.90' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='71'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='71'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='2.10'/> <input type='hidden' id='bet' name='bet' value='Estudiantes '/> <input type='hidden' id='event' name='event' value='Estudiantes - Botafogo'/> <input type='submit' class='remove' value='2.10' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='132'/> </td> </form> <td>Estudiantes </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.00'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Estudiantes - Botafogo'/> <input type='submit' class='remove' value='3.00' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='132'/> </td> </form> <td> Botafogo</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.30'/> <input type='hidden' id='bet' name='bet' value=' Botafogo'/> <input type='hidden' id='event' name='event' value='Estudiantes - Botafogo'/> <input type='submit' class='remove' value='3.30' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='132'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='132'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.65'/> <input type='hidden' id='bet' name='bet' value='River Plate'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='1.65' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='148'/> </td> </form> <td>River Plate</td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.20'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='3.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='148'/> </td> </form> <td>Chivas</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='5.20'/> <input type='hidden' id='bet' name='bet' value='Chivas'/> <input type='hidden' id='event' name='event' value='River Plate - Chivas'/> <input type='submit' class='remove' value='5.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='148'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='148'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='2.10'/> <input type='hidden' id='bet' name='bet' value='Internacional '/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='2.10' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='149'/> </td> </form> <td>Internacional </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.10'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='3.10' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='149'/> </td> </form> <td> Boca Juniors</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='3.20'/> <input type='hidden' id='bet' name='bet' value=' Boca Juniors'/> <input type='hidden' id='event' name='event' value='Internacional - Boca Juniors'/> <input type='submit' class='remove' value='3.20' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='149'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='149'/> <input type='submit' class='remove' value='[+]' /> </td> </form> <tr> <td>24:00</td> <form name='beth' method='post' action='temp_coupon.php'> <td> <input type='hidden' id='winings' name='winings' value='1.35'/> <input type='hidden' id='bet' name='bet' value='Palmeiras '/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='1.35' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='150'/> </td> </form> <td>Palmeiras </td> <form name='betd' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='4.00'/> <input type='hidden' id='bet' name='bet' value='X'/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='4.00' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='150'/> </td> </form> <td> Argentinos Jrs</td> <form name='beta' action='temp_coupon.php' method='post'> <td> <input type='hidden' id='winings' name='winings' value='8.00'/> <input type='hidden' id='bet' name='bet' value=' Argentinos Jrs'/> <input type='hidden' id='event' name='event' value='Palmeiras - Argentinos Jrs'/> <input type='submit' class='remove' value='8.00' /> <input type='hidden' id='type' name='type' value='football'/> <input type='hidden' id='game_id' name='game_id' value='150'/> </td> </form> <form action='specials.php' method='post'> <td> <input type='hidden' id='game_id' name='game_id' value ='150'/> <input type='submit' class='remove' value='[+]' /> </td> </form><tr><td colspan='4'></td></tr><tr><td colspan='4'><u><b>04.11.08</b></u></td></tr><tr><td colspan='4'></td></tr></tr> </table> <a href='games_show_all.php'>View All Available Games</a></div> <style> .remove { background-color:#333333; border-style:none; border-color:#333333; cursor:pointer; color:#FFFFFF; } </style> </div> </td><td valign="top" align="left"> <div id="sidebarr" align="left"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function get_total() { $('#poss_win').load('amount_check.php',{ 'stake' : $('#stake').val(), 'session': $('#session').val() }); } </script> <script type="text/javascript"> function check_games() { $('#bet_state').load('bet_check.php',{ 'session': $('#session').val() }); } </script> <table cellspacing='2' width='380' bgcolor='#333333' border='0' > <tr> <td width='260'><u><b> Game </b></u></td> <td width='150' align='left'><u><b> Bet </b></u></div></td> <td width='40'><div align='center'><u><b> Winings </b></u></div></td> </tr><tr><form action='remove_bet.php' method='post'><tr> <input type='hidden' name='event1' value='Kuruvchi - Adelaide'/> <td><input type='hidden' value='Kuruvchi - Adelaide'/>Kuruvchi - Adelaide</td> <td>Kuruvchi</td> <td align='right'>1.75</td> <td><input type='submit' value='X' class='remove' /><input type='hidden' name='game_id' id='game_id' value='135' /></td> </tr></td></tr></form><form action='remove_bet.php' method='post'><tr> <input type='hidden' name='event1' value='America Rn - Santo Andre'/> <td><input type='hidden' value='America Rn - Santo Andre'/>America Rn - Santo Andre</td> <td> Santo Andre</td> <td align='right'>2.50</td> <td><input type='submit' value='X' class='remove' /><input type='hidden' name='game_id' id='game_id' value='69' /></td> </tr></td></tr></form><tr><td><span id="bet_state"></span></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td><tr><td></td><td><b>Total:</b></td><td align='right'>4.38</td></tr><td></td><td align='left'><b>Bet Stake:</b></td> <td align='left'> <form name='amount' id='amount' method='post'> <input type='text' name='stake' id='stake' size='10' value='1' autocomplete='off' onkeyup='get_total()' /> <input type='hidden' name='event1' value=''/> </td></tr> <tr><td></td><td><b>Possible Winnings:</b></td><td><span id='poss_win'></span> <input type='hidden' name='session' id="session" value='70b8e24f63cd4d6f2154107b5ab78d2c' /> <input type='hidden' name='total' id='total' value='4.38' /><tr><td><input type='submit' value='Continue>>' onClick="check_games()" class='remove' /> </form></td></tr> </table> <style> .remove { background-color:#333333; border-style:none; border-color:#333333; cursor:pointer; color:#FFFFFF; } </style> </div> </td> </tr></table> </div> < </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 the problem is in how you call it: <input type='submit' value='Continue>>' onClick="check_games()" class='remove' /> it's a Submit button, so while it will do the AJAX call when you click it, it will also submit the form, therefore reloading the page and making it look like the AJAX never happened. so, change that to a normal button: <input type='button' value='Continue>>' onClick="check_games()" class='remove' /> Quote Link to comment Share on other sites More sharing options...
solon Posted November 3, 2008 Author Share Posted November 3, 2008 That's correct! Thank you very much rhodesa ! I really appreciate The help and thank you for your time Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.