Jump to content

dawg1

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by dawg1

  1. So I figured out my problem with IE. Caching. To resolve the issue I added + escape(new Date()); to my var strURL. As for the minibasket replacing the parent div, it still does it. I think the issue is because the mini .hidden div is stacked inside the mini div... <div id="mini"> <div class="hidden"></div> </div>
  2. Ok, I believe I have resolved the JS errors. Now in IE the only mini div that loads says the cart is empty, but, again, works great in firefox, chrome, safari.
  3. Thanks for the advice. I put in the code and I am getting alerts, I'm not exactly sure where or what I need to fix.... function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { alert($('#mini').html()); document.getElementById('mini').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } I get the first alert (screenshot_1.png) after I add my first product. I get the second alert (screenshot_2.png) thereafter (for each product I add after the first, I get this same alert). So it appears that the div is not refreshing, or loading in the new products, after the first product is added. I can even go to my shopping cart (a different page on the website) clear the entire cart, go back to the product page, add a new (different) product, and the minibasket loads with the information of the very first product -which is no longer even in the basket. Any ideas??? [attachment deleted by admin]
  4. This works great in firefox, but in IE the div with refresh only 1 time. Any suggestions how to fix it so that continues to refresh?
  5. Ok, got it to update my <div id="mini"> with function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { document.getElementById('mini').innerHTML=req.responseText; } } } req.open("GET", strURL, true); req.send(null); } } </script> Next step, hide <div id="bookcart"> function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { document.getElementById('mini').innerHTML=req.responseText; } } } req.open("GET", strURL, true); req.send(null); } setTimeout( "jQuery('#bookcart').fadeOut();",1000 ); } Problem is that it hides the 'mini' div, not just bookcart, and I can't figure out why. html <div id="mini"> ---CONTENT--- <div class="hidden"> <div id="bookcart"> <div id="minibask">---CONTENT---</div> <div id="minibask_total">---MORE CONTENT---</div> </div> </div> </div> - OR - html/Miva script (if you're familiar with Miva Merchant) <div id="mini"> <mvt:item name="toolkit" param="basket|itemcount" /> <mvt:if expr="g.itemcount GT 0"> <a href="&mvt:global:secure_sessionurl;Screen=BASK" title="checkout" border="0"><img src="graphics/00000001/images/ShoppingCart.png" class="textmiddle" alt="Shopping Cart" /></a> <h8><strong>(&mvte:toolkit:basketcount;)</h8></strong> <div class="hidden"><mvt:item name="toolkit" param="render|TKMINI" /></div> <mvt:else> <a href="&mvt:global:secure_sessionurl;Screen=BASK" title="checkout" border="0"><img src="graphics/00000001/images/ShoppingCart.png" class="textmiddle" alt="Shopping Cart" /></a> (0) </mvt:if> </div> css #mini { padding: 2px; width:150px; float:right; } #mini .hidden { display:none; } #mini:hover .hidden { display:inline; } #minibask { background-color: #eeeeee; border:#cccccc 2px solid; position:relative; width:350px; line-height:1.1em; z-index:100; } #minibask_total { background-color: #cccccc; border:#cccccc 2px solid; width:350px; text-align:right; position:relative; z-index:100; line-height:1.1em; } Any Ideas?
  6. Thanks for responding! I should mention that I am quite a newbie to .js I have been searching the web for callback functions but I don't know that I am moving in the right direction. Could you share some sites that could help me out? I take that I need to edit the .js file and put a script in my html?
  7. Hi All! I am using a Greybox (found at: orangoo.com/labs/GreyBox/) to display my product pages, like the quick product display on Target.com. I have a minibasket in a div on the parent page where after a product is added to the cart the div updates and displays the cart info onhover. Problem is that the only way I know of to update the parent page is modifying the gb_scripts.js with 'this.reload_on_close=true' 'window.location.reload(true);' I want to avoid reloading the entire parent page so that the customer doesn't have to restart their product search - as it gets reset when the page reloads. Is there a way to only refresh the minibasket div?
  8. This script works great, the only problem is that it reloads the page on each selection. I use flash and would really like the page (and flash content) to not be reloaded on each selection. The code is below... <?php //*************************************** // This is downloaded from www.plus2net.com // /// You can distribute this code with the link to www.plus2net.com /// // Please don't remove the link to www.plus2net.com /// // This is for your learning only not for commercial use. /////// //The author is not responsible for any type of loss or problem or damage on using this script.// /// You can use it at your own risk. ///// //***************************************** require "config.php"; // Your Database details ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <meta name="GENERATOR" content="Arachnophilia 4.0" /> <meta name="FORMATTER" content="Arachnophilia 4.0" /> <SCRIPT language=JavaScript> function reload(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; self.location='http://www.dawgwear.net/dd3.php?TERM=' + val ; } function reload3(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; var val2=form.CURR.options[form.CURR.options.selectedIndex].value; self.location='http://www.dawgwear.net/dd3.php?TERM=' + val + '&CURR=' + val2 ; } </script> I'm new to php/ajax so I would really appreciate some help or direction as to where I can get some answers! Thanks in advance! Jeanna
  9. --------EDIT FOR INITIAL POST-------------(not sure why I can't modify the original post) echo "<form method=post name=f1 action='dd3.php'>"; is actually echo "<form method=post name=f1 action='dd3ck.php'>"; in my current code
  10. <SCRIPT language=JavaScript> function reload(form) { var val=form.price.options[form.price.options.selectedIndex].value; self.location='dd3.php?price=' + val ; } function reload3(form) { var val=form.price.options[form.price.options.selectedIndex].value; var val2=form.weight.options[form.weight.options.selectedIndex].value; self.location='dd3.php?price=' + val + '&weight=' + val2 ; } </script> <? --GET DATA HERE-- echo "<form method=post name=f1 action='dd3.php'>"; --DROP DOWN LISTS HERE-- echo "<input type=submit value='View'></form>"; ?> How can I change the script above so that the results will be returned on the same page? Below is an AJAX function that can return the results to a div on the same page AJAX Script: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var price = document.getElementById('price').value; var weight = document.getElementById('weight').value; var taxable = document.getElementById('taxable').value; var queryString = "?price=" + price + "&weight=" + weight + "&taxable=" + taxable; ajaxRequest.open("GET", "ajax_example.php" + queryString, true); ajaxRequest.send(null); } //--> </script> <div id='ajaxDiv'>Your result will display here</div> I know there has to be a way to get what I need from these two functions, but I can't put it together! Any help would be much appreciated!!! Thanks!
  11. GOT IT <a href=\"page/D/PROD/$row[code]\"> Thanks SO MUCH!
  12. K, I did that, and made sure the case was correct, but still no luck. The data displays just fine when I don't try to make it a link. <?php $dbhost = ""; $dbuser = ""; $dbpass = ""; $dbname = ""; //Connect to MySQL Server mysql_connect($dbhost, $dbuser, $dbpass); //Select Database mysql_select_db($dbname) or die(mysql_error()); // Retrieve data from Query String $price = $_GET['price']; $taxable = $_GET['taxable']; $weight = $_GET['weight']; $code = $_GET['code']; // Escape User Input to help prevent SQL Injection $price = mysql_real_escape_string($price); $taxable = mysql_real_escape_string($taxable); $weight = mysql_real_escape_string($weight); $code = mysql_real_escape_string($code); //build query $query = "SELECT * FROM Products WHERE taxable = '$taxable'"; if(is_numeric($price)) $query .= " AND price <= $price"; if(is_numeric($weight)) $query .= " AND weight <= $weight"; //Execute query $qry_result = mysql_query($query) or die(mysql_error()); //Build Result String $display_string = "<table>"; $display_string .= "<tr>"; $display_string .= "<th>Code</th>"; $display_string .= "<th>Price</th>"; $display_string .= "<th>Taxable</th>"; $display_string .= "<th>Weight</th>"; $display_string .= "</tr>"; // Insert a new row in the table for each product returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td><a href="www.dawgwear.net/page/D/PROD/$code">$row[code]</a></td>"; $display_string .= "<td>$row[price]</td>"; $display_string .= "<td>$row[taxable]</td>"; $display_string .= "<td>$row[weight]</td>"; $display_string .= "</tr>"; } echo "Query: " . $query . "<br />"; $display_string .= "</table>"; echo $display_string; ?> I am using javascript on my webpage that displays the results...might there be something there I need to adjust as well? <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var price = document.getElementById('price').value; var weight = document.getElementById('weight').value; var taxable = document.getElementById('taxable').value; var queryString = "?price=" + price + "&weight=" + weight + "&taxable=" + taxable; ajaxRequest.open("GET", "ajax_example.php" + queryString, true); ajaxRequest.send(null); } //--> </script>
  13. Thanks for responding so fast! I tried your suggestion but when I add the html code for the link no results display. Did I set it up correctly? <?php $dbhost = ""; $dbuser = ""; $dbpass = ""; $dbname = ""; //Connect to MySQL Server mysql_connect($dbhost, $dbuser, $dbpass); //Select Database mysql_select_db($dbname) or die(mysql_error()); // Retrieve data from Query String $price = $_GET['price']; $taxable = $_GET['taxable']; $weight = $_GET['weight']; $code = $_GET['code']; // Escape User Input to help prevent SQL Injection $price = mysql_real_escape_string($price); $taxable = mysql_real_escape_string($taxable); $weight = mysql_real_escape_string($weight); $code = mysql_real_escape_string($code); //build query $query = "SELECT * FROM Products WHERE taxable = '$taxable'"; if(is_numeric($price)) $query .= " AND price <= $price"; if(is_numeric($weight)) $query .= " AND weight <= $weight"; //Execute query $qry_result = mysql_query($query) or die(mysql_error()); //Build Result String $display_string = "<table>"; $display_string .= "<tr>"; $display_string .= "<th>Code</th>"; $display_string .= "<th>Price</th>"; $display_string .= "<th>Taxable</th>"; $display_string .= "<th>Weight</th>"; $display_string .= "</tr>"; // Insert a new row in the table for each person returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td><a href="www.storefront.net?$Code">$row[code]</a></td>"; $display_string .= "<td>$row[price]</td>"; $display_string .= "<td>$row[taxable]</td>"; $display_string .= "<td>$row[weight]</td>"; $display_string .= "</tr>"; } echo "Query: " . $query . "<br />"; $display_string .= "</table>"; echo $display_string; ?>
  14. I've tried to find an answer in the forum and although there have been posts similar I am unable to covert the answer to fit what I've got (mostly because I know very very little about php - sorry). What I need is one of the results to be added to the end of a url in order to create a link. Basically I have a storefront (www.storefront.com/) and the result NAME can be added onto the end of our url to create a link to the product page. (www.storefront.com/NAME) <?php $dbhost = ""; $dbuser = ""; $dbpass = ""; $dbname = ""; //Connect to MySQL Server mysql_connect($dbhost, $dbuser, $dbpass); //Select Database mysql_select_db($dbname) or die(mysql_error()); // Retrieve data from Query String $price = $_GET['price']; $taxable = $_GET['taxable']; $weight = $_GET['weight']; // Escape User Input to help prevent SQL Injection $age = mysql_real_escape_string($price); $sex = mysql_real_escape_string($taxable); $wpm = mysql_real_escape_string($weight); //build query $query = "SELECT * FROM Products WHERE taxable = '$taxable'"; if(is_numeric($price)) $query .= " AND price <= $price"; if(is_numeric($weight)) $query .= " AND weight <= $weight"; //Execute query $qry_result = mysql_query($query) or die(mysql_error()); //Build Result String $display_string = "<table>"; $display_string .= "<tr>"; $display_string .= "<th>Name</th>"; $display_string .= "<th>Price</th>"; $display_string .= "<th>Taxable</th>"; $display_string .= "<th>Weight</th>"; $display_string .= "</tr>"; // Insert a new row in the table for each person returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td>'<a href="www.storefront.com/">' . $row[name] . ' </a>'/td>"; $display_string .= "<td>$row[price]</td>"; $display_string .= "<td>$row[taxable]</td>"; $display_string .= "<td>$row[weight]</td>"; $display_string .= "</tr>"; } echo "Query: " . $query . "<br />"; $display_string .= "</table>"; echo $display_string; ?> I know the way it is setup in the code is wrong. Can anyone help me out? Would really appreciate it. Thanks - and again, sorry for my lack of php knowledge.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.