View Single Post
Old 02-05-2009, 01:16 PM   PM User | #2
fxr
New to the CF scene

 
Join Date: Feb 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
fxr is an unknown quantity at this point
i have worked on this overnight and worked out that using innerHTML was my avenue to success. ll post my code for anyone who may stumble on this or be interested.

Relevant snippets of code.

Code:
<script type="text/javascript">
 function DLChange(newHTML){
	 document.getElementById('tradeID').innerHTML = newHTML;
		 }
 
 function sendRequestClose() {
 
	   new Ajax.Request("sendmailclose.php", {
			method: 'post',
			postBody: "tradeID="+$F("tradeID")+"&closeprice="+$F("closeprice"),
			   
			onLoading: showLoading, //have to add alert
				  
			onSuccess: function(transport){
					 var response = transport.responseText || "no response text";
					 var responder=response.split("<!-- DL -->");
 
					 alert("Success! \n\n" + responder[0]);
					 DLChange(responder[1]);
 
												 },
				  
			 onFailure: function(){ alert('NO EMAILS SENT - NO RESPONSE FROM SERVER') },
												 
			 onComplete: hideLoading	}
	 
							 );
											 
		 }
 </script>
 
 ....
 
 CLOSE TRADE : 
 <select name="tradeID" id="tradeID">
 <!-- PHP -->
	  <?php
	   include 'opentrades.php';
	   ?>
opentrades.php looks like this and is included at the bottom of my sendmailclose.php script.

Code:
<?php
		// Make a MySQL Connection
		mysql_connect("localhost", "ssss", "sssss")or die(mysql_error());
		mysql_select_db("db")or die(mysql_error());		
		$result = @mysql_query("SELECT ID,opentime,pair,openprice,LS FROM logopen");
		 print "<!-- DL -->";
		 while ($row = mysql_fetch_assoc($result)) {
			$tradeID = $row['ID'];
			$opentime = $row['open_time'];
			$pair = $row['pair'];
			$price = $row['open_price'];}
			$LS = $row['LS'];
			print "<option value=$tradeID id=$tradeID>$tradeID $LS $pair $price $opentime";}
			print "</select>";
			?>
fxr is offline   Reply With Quote