Jump to content

Search the Community

Showing results for tags 'jquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. I am a newbee in php, jquery and ajax. I have a code in jquery to add and remove the textboxes dynamically on button click. I want to post the values of dynamically created textbox values to next page and display those values on action page as well as insert them into db. Any help is much appreciated. Thanks in advance. Please click on the link to see how the textboxes are dynamically created. http://jsfiddle.net/NSePb/1/ I have uploaded the two pages. I want to post the data from quotations.phpquotations.php to quot_rec.php and display the posted values on quot_rec.phpquot_rec.php
  2. I have a form that has 2 dropdown lists (Diplomas, Fields), a submit button and an "Add" button that copies the selected values of the dropdownlists to some dynamically generated textboxes as long as the number of the textboxes is lower than 5 This is the code of the dipSecSelection.php file included inside the form: <!----------- The dipSecSelection File -------------> <div id="dipSecSelection"> <table> <tr> <td><label for="diplomes">Diplome:</label></td> <td> <select name="Diplomes" id="Diplomes"> <option value="na">--Diplome--</option> <option value="Technician">Technician</option> <option value="Master">Master</option> <option value="PhD">PhD</option> </select> </td> <td id="separator">|</td><!-- Separator --> <td><label for="secteurs">Secteur:</label></td> <td> <select name="Secteurs" id="Secteurs"> <option value="na">--Secteur--</option> <option value="Software Dev">Software Dev</option> <option value="Engineering">Engineering</option> <option value="Physics">Physics</option> </select> </td> <td> <a href="#" Onclick="addDipSec()" value="Add" class="button">Add</a> </td> </tr> </table> <table> <tr> <td><div id='DipTextBoxesGroup'></div></td> <td><div id='SecTextBoxesGroup'></div></td> </tr> </table> </div> <script type="text/javascript"> //Diplomas textBoxes!!! var counterdip = 1; var countersec = 1; function addDipSec(){ if(counter>5){ alert("Only 5 Diplomas allow"); return false; } var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counterdip); newTextBoxDiv.after().html('<label>Diplome #'+ counterdip + ' : </label>' + '<input type="text" name="dipBox[]" id="textboxdip' + counterdip + '" value="" >'); newTextBoxDiv.appendTo("#DipTextBoxesGroup"); $('#textboxdip'+counterdip).val($('#Diplomes option:selected').html()); counter++; //Secteurs textBoxes if(countersec>5){ alert("Only 5 Setors are allowed"); return false; } var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + countersec); newTextBoxDiv.after().html('<label>Secteur #'+ countersec + ' : </label>' + '<input type="text" name="secBox[]" id="textboxsec' + countersec + '" value="" size="35">'); newTextBoxDiv.appendTo("#SecTextBoxesGroup"); $('#textboxsec'+countersec).val($('#Secteurs option:selected').html()); countersec++; alert(secBox[0].val); } </script> This is the php code: <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST" enctype="multipart/form-data"> <?php include'includes/dipSecSelection.php'?> <?php if(isset($_POST['dipBox']) && isset($_POST['secBox'])){ if(!empty($_POST['dipBox'])&&!empty($_POST['secBox'])){ $dip= $_POST['dipBox']; $sec= $_POST['secBox']; $N = count($dip); for($i=0; $i < $N; $i++){ $add_AnnDipSec = "INSERT INTO annDipSec VALUES('$dip[$i]','$sec[$i]')"; if(mysqli_query($connection, $add_AnnDipSec)){ echo'Successfully Added to AnnDipSec'; }else{echo'Error while trying to insert into AnnDipSec';} } }else{echo"Dip and Sec were Empty";} } ?> <input type="submit" name="submit" value="Submit" class='button'> </form> Problem is that dipBox[] and secBox[] never get set and always return nothing so they never get inserted to the database table.
  3. Dear members, I m running with the following problem for more than a week but i m not able to sort out. The scenario is that, in one of my php form i m having two dropdown and a text box related to each other. i.e when i select a product from dropdown1, the values of dropdown2 will be sorted based on the value of dropdown1 and similarly based on the value of dropdown2 , the value of textbox will be shown. This i accomplished with the help of ajax and jquery. And also this one working for me very well(shown in the image 1&2 of attachements). But the issue now is, in my product selection, my product list went very long so i had to bring an auto-suggestion. i brought the jquery selection with auto-complete model which has been shown in the same attachment(image3&4). the issue now is, when i select the product from my first dropdown, the second dropdown value is not loading, with firebug i checked, the values are properly retrieved for second dropdwn based on first drpdown but its not shwn up in the value list of second dropdwn. I don know what exactly the problem is. I m thinking it might be the clash of jquery versions that i m using. So, can some sort me out the problem with my form. I have included the form code here. <link rel="stylesheet" href="<?php echo HOME_URL; ?>chosen/chosen.css" /> <style type="text/css"> td { width:800px; } </style> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <script type="text/javascript" charset="utf-8"> $(function(){ $("select#product_id").change(function(){ var get_package_url = '<?php echo HOME_URL; ?>select.php'; $.getJSON(get_package_url,{product_id: $(this).val(), ajax: 'true'}, function(j){ var options = ''; options += '<option value="0"> -- Select -- </option>'; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; } $("select#package_id").html(options); }) }) $("select#package_id").change(function(){ var get_package_url = '<?php echo HOME_URL; ?>select.php'; $.getJSON(get_package_url,{package_id: $(this).val(), ajax: 'true'}, function(j){ for (var i = 0; i < j.length; i++) { var value = j[i].optionDisplay; } $("#package_qty").val(value); }) }) }) </script> <script> $(function() { $( "#datepicker" ).datepicker({ altFormat: "dd-mm-yyyy" }); }); </script> <form action="<?php echo base_url(); ?>purchase_order/add" method="post"> <table border="1"> <tr> <td> <b>Product </b> <select name="product_id" style="width:250px;" data-placeholder="Choose a Supplier..." id="product_id" class="chzn-select"> <option value="0"> -- Select Product -- </option> <?php foreach($get_all_product as $value) { ?> <option value="<?php echo $value['product_id']; ?>"><?php echo $value['product_name']; ?></option> <?php }?> </select> </td> <td> <b>Order Qty </b> <input type="text" name="quantity" value="" style="width:75px;" /></td> <td> <b>Package</b> <select name="package_id" id="package_id"> </select> </td> <td> <b> Qty / Packing</b> <input type="text" name="package_qty" id="package_qty" value="" readonly="readonly" style="width:75px;" /></td> <td colspan="2"> <input type="submit" name="submit" value="Add to Cart" /> </td> </tr> </table> <script src="<?php echo HOME_URL; ?>chosen/chosen.jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); </script> </form><br/><br/> <?php if($this->cart->contents()) { ?> <h2>Ordered Cart</h2> <br/> <table border="1"> <tr> <td> <b> Product </b> </td> <td> <b> Order Qty</b> </td> <td> <b>Qty/ Packing</b></td> <td> <b> MRP</b> </td> <td align="right"> <b>Amount </b></td> <td align="right"> <b>Action </b></td> </tr> <?php $grand_total = 0; foreach ($this->cart->contents() as $items) { ?> <tr> <td> <?php echo $items['name']; ?></td> <td> <?php echo $items['qty']; ?></td> <td> <?php echo $items['package_qty']; ?></td> <td> <?php echo $items['price'];//money_format('%!i',$items['price']); ?></td> <td align="right"> <?php echo $items['amount'];//money_format('%!i', $items['amount']); $grand_total = $items['amount']+$grand_total; $discount= $grand_total * 40/100; $gross_amount = $grand_total-$discount; ?></td> <td align="right"> Remove </td> </tr> <?php } ?> <tr> <td colspan="5" align="right"><b>Grand Total</b></td> <td align="right"><b><?php echo $grand_total;//money_format('%!i', $grand_total); ?></b></td> </table> <form method="post" action="<?php echo base_url()."purchase_order/create"; ?>"> <BR/> <BR/> Addtional Details : <textarea rows="5" cols="80" name="info"></textarea> <BR/> Date : <input type="text" name="date" value="<?php echo date('d-m-Y'); ?>" /><br/><br/><br/> <h2> Approximate value of Order</h2><br/> <b>Gross Amount:<b><?php echo $grand_total;?><br/> <b>Less Discount @ 40%:<b><?php echo $discount;?><br/> <b>Net Amount:<b><?php echo $gross_amount;?><br/> <input type="submit" name="submit" value="Create PO" /> </form> <?php } ?>
  4. I need some help trying to get this page to load the "#page1" when the page initially loads. I've tried a couple things but am either getting nothing (from the display:none in CSS) or if I remove that, it displays all the "#page1-6" elements alltogether when the page initially loads. It works fine once I start clicking the menu, its just the initial loading. .page { position: relative; display: none; } </style> </head> <body > <script src="jquery.js"></script> <script> $(document).ready(function() { $(".page-link").on("click", function(e) { $(".page").fadeOut(250); setTimeout(function() { $($(e.currentTarget).attr("href")).fadeIn(250); }, 250); }); });</script> <ul class="semiopaquemenu"> <li><a href="#page1" class="page-link"><span class="titlefont">Gallery</span></a></li> <li><a href="#page2" class="page-link"><span class="titlefont">Bio</a></li> <li><a href="#page3" class="page-link"><span class="titlefont">Statement</span></a></li> </ul> <div id="pages"> <div id="page1" class="page"> <h1>Page 1</h1> <p>This is the first test page.</p> </div> <div id="page2" class="page"> <h1>Page 2</h1> <p>This is the second test page.</p> </div> <div id="page3" class="page"> <h1>Page 3</h1> <p>This is third test page.</p> </div>
  5. Hi all, I am making a flight search engine where i am trying to create a autocomplete textbox. I mean when a user starts typing in the textbox, it will show all related data from my database table. I am new to programming and therefore I have adopt a code from online but it doesn't work, I don't know why. Can anyone please help? If you know any other easy way of doing it, please tell me also This is my Javascript code: <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type='text/javascript' src="js/jquery.autocomplete.js"></script> <script type="text/javascript"> $().ready(function() { $("#depAirport").autocomplete("autoCompleteMain.php", { width: 260, matchContains: true, //mustMatch: true, //minChars: 0, //multiple: true, //highlight: false, //multipleSeparator: ",", selectFirst: false }); }); </script> This is my html: <form> <label for="depAirport">Deperture airport</label> <input type="text" id="depAirport" name="depAirport" placeholder="Type destination airport" required autofocus> </form> and this is my php: <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="airline_database"; // Database name $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); $q = strtolower($_GET["q"]); if (!$q) return; $sql = "select DISTINCT departure_airport as departure_airport from depAirport where departure_airport LIKE '%$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $cname = $rs['departure_airport']; echo "$cname\n"; } ?> PLEASE HELP ASAP
  6. how to submit form in selected tab without any refresh and only stay on that tab???
  7. I'm hoping someone can help me out with this, I'm relatively new to PHP as my background is ASP, so I'm a bit stuck. I'm using the following code as demonstrated here htmlblog.us/jquery-autocomplete ...and I've customized it (slightly) to pull information from my mysql database. Everything is working fine, however, my problem is that when the user selects a specific location from the dropdown, its passing over the suburb, the state, and the postcode. I only want to pass over the postcode value, so I can handle the results easily on the search results page. If I use this.... while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ) { $data[] = array( 'label' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] , 'value' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] .'; ' ); It posts this to my search results page... (eg showing a search for Brisbane, QLD; 4000) Array ( [zipsearch] => BRISBANE, QLD 4000; ) I only want the postcode value. So instead, I would like ... Array ( [zipsearch] => 4000; ) I tried doing this.... while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ) { $data[] = array( 'label' => $row['pcode_area'] .', '. $row['pcode_state'] .' '. $row['pcode_postcode'] , 'value' => $row['pcode_postcode'] .'; ' ); ..which passes over just the postcode like I want, but that's no good because upon selection, the suburb and state disappear leaving just the postcode in the selection box, which may confuse people. I'm pretty sure there's an easy way to do this, but being new to PHP, I'm a bit lost. I would really appreciate some help with this, as I'd like to get this sorted ASAP. Thank you. John
  8. I've searched everywhere and just can't seem to find my answer, so here: I'm powerful with php and that I can deal with, but I never really had the chance to develop my javascript skills. I want to use JQuery to load part of a page in a container div. The problem is every tutorial I check out, the target (or result) div where the content will load is already defined in the function. Is there a way to include 2 arguments like this : (pseudo-code, I don't know the real syntax, still a newb at JQuery) function ajaxpage(url, containerid){ // do the magic here } // and calling the page <a href="javascriptTheJQueryWayHere:ajaxpage('page.php?id=12','load_in_this_div')">link</a> <div id="load_in_this_div"></div> I don't necessarily want a baked answer, just any link to any resource except RTFM would be of great help!
  9. i have a many links like these <a href="www.ex.com/action.php?me=1">member1</a> i wanted to get this by ajax get method.. <script> $("a.member").click(function(e){ $.ajax({ type: "GET", url: "action.php?me=", data: "me=" + me, success: function(data){ alert(data); } }); return false; e.preventDefault(); }); </script> i know somethin wrong here..am in re.php..i am using this to navigate to action.php file.. Any help appreciated..
  10. Before asking any questions,i would like to thank phpfreaks forum for answering my questions.. Really helpful, thanks again.. i have this tabbed menu.. it worked nicee.. but when i add input submit at last, it is not shown,pls help.. might be css issue, tried that some things, but didn't work, pls help... css <style> ul.tabs { margin: 0; padding: 0; float: left; list-style: none; height: 32px; /*--Set height of tabs--*/ border-bottom: 1px solid #999; border-left: 1px solid #999; width: 100%; } ul.tabs li { float: left; margin: 0; padding: 0; height: 31px; /*--Subtract 1px from the height of the unordered list--*/ line-height: 31px; /*--Vertically aligns the text within the tab--*/ border: 1px solid #999; border-left: none; margin-bottom: -1px; /*--Pull the list item down 1px--*/ overflow: hidden; position: relative; background: #e0e0e0; } ul.tabs li a { text-decoration: none; color: #000; display: block; font-size: 1.2em; padding: 0 20px; border: 1px solid #fff; /*--Gives the bevel look with a 1px white border inside the list item--*/ outline: none; } ul.tabs li a:hover { background: #ccc; } html ul.tabs li.active, html ul.tabs li.active a:hover { /*--Makes sure that the active tab does not listen to the hover properties--*/ background: #fff; border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/ } .tab_container { border: 1px solid #999; border-top: none; //overflow: hidden; clear: both; float: left; width: 100%; background: #fff; height:auto; } .tab_content { padding: 20px; font-size: 1.2em; color:#333; height:auto; } * { margin:0; // disable for button padding:0; // disable for button border:0; // disable for button } </style> script for tab <script type="text/javascript"> $(document).ready(function() { //Default Action $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); }); </script> <ul class="tabs"> <li><a href="#tab1">First tab</a></li> <li><a href="#tab2">Second tab</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> Content of the first tab </div> <div id="tab2" class="tab_content"> Content </div> when i used the content area to display my form, it was displayed.. but then when i included the submit button it is not seen.. but then when i use only submit button (no form content)it is displayed. what am doin wrong..pls help..
  11. hello all, am beginning to use jquery.. i am using the code online.. all works fine but when i remove 2 lines it fails.. these two lines are simple input fields.. plss help..no idea what am doing wrong.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Example Ajax and Form</title> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script> <script type="text/javascript"><!-- // create the XMLHttpRequest object, according browser function get_XmlHttp() { // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value) var xmlHttp = null; if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject) { // for Internet Explorer 5 or 6 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlHttp; } // sends data to a php file, via POST, and displays the received answer function ajaxrequest(php_file, tagID) { var request = get_XmlHttp(); // calls the function for the XMLHttpRequest instance // gets data from form fields, using their ID var nume = document.getElementById('nume').value; var mesaj = document.getElementById('mesaj').value; var datepicker = document.getElementById('datepicker').value; var hour = document.getElementById('hour').value; var minute = document.getElementById('minute').value; var dhour = document.getElementById('dhour').value; var dminute = document.getElementById('dminute').value; // create pairs index=value with data that must be sent to server var the_data = 'datepicker='+datepicker+'&hour='+hour+'&minute='+minute+'&dhour='+dhour+'&dminute='+dminute; request.open("POST", php_file, true); // sets the request // adds a header to tell the PHP script to recognize the data as is sent via POST request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(the_data); // sends the request // Check request status // If the response is received completely, will be transferred to the HTML tag with tagID request.onreadystatechange = function() { if (request.readyState == 4) { document.getElementById(tagID).innerHTML = request.responseText; } } } --></script> <style> .left{float:left;} .clear{clear:both;} </style> </head> <body> <br /> <b>Create Appointment</b><br><br> <form action="new.php" method="post" name="form1" onsubmit="ajaxrequest('new.php', 'resp'); return false;"> <label class="left" for="datepicker" id="hour_label" class="small">Hours<br> Date: <input type="text" name="datepicker" id="datepicker"/></label> <br><br><br><br> </form> <br> Trainer Availabity<br> <form action="new.php" method="post" name="form1" onsubmit="ajaxrequest('new.php', 'resp'); return false;"> Your name: <input type="text" name="nume" id="nume" size="20" maxlength="33" /><br /> Your message:<br /> <textarea name="mesaj" id="mesaj" cols="25" rows="4"></textarea><br /> <b>Time</b><br> <label class="left" for="hourid" id="hour_label" class="small">Hours<br> <?php $number = range(00,24); $tempholder = range(00,24); $nr=24; echo '<select class="doba" name="hour" id="hour">'; echo '<option value="" selected="selected">--Select Hour--</option>'; for ($i=0; $i<$nr; $i++) { echo "<option>".$tempholder[$i]."</option>"; } echo '</select>'; ?> </label> <label class="left" for="minute" id="minute_label" class="small">Minute<br> <?php $number = range(1,60); $tempholder = range(1,60); $nr=60; echo '<select name="minute" id="minute">'; echo '<option value="" selected="selected">--Select Minute--</option>'; for ($i=0; $i<$nr; $i++) { echo "<option>".$tempholder[$i]."</option>"; } echo '</select>'; ?> </label> <br><br><br><br> <div class="clear"><b>Duration</b></div> <div class="clear"></div> <label class="left" for="dhour" class="small" id="dhour_label">Hours<br> <?php $number = range(00,05); $tempholder = range(00,05); $nr=5; echo '<select class="doba" name="dhour" id="dhour">'; echo '<option value="" selected="selected">--Select Hour--</option>'; for ($i=0; $i<$nr; $i++) { echo "<option>".$tempholder[$i]."</option>"; } echo '</select>'; ?> </label> <label class="left" for="dminute" class="small" id="dminute_label">Minute<br> <?php $number = range(1,60); $tempholder = range(1,60); $nr=60; echo '<select name="dminute" id="dminute">'; echo '<option value="" selected="selected">--Select Minute--</option>'; for ($i=0; $i<$nr; $i++) { echo "<option>".$tempholder[$i]."</option>"; } echo '</select>'; ?> </label> <input type="submit" value="Search Trainer Availabity" /> </form> <div id="resp"></div> </body> </html> when i remove Your name: <input type="text" name="nume" id="nume" size="20" maxlength="33" /><br /> Your message:<br /> <textarea name="mesaj" id="mesaj" cols="25" rows="4"></textarea><br /> it shows the output php file,not the current file... pls help!!!
  12. I am pulling stock symbols from Yahoo finance in a json object and I am trying to show them as a drop-down menu while the user starts typing the name of the company or the symbol in the search box . Typeahead is not working as a drop down menu from the search box. I think I am doing everything right.This is the code I have so far. Any help is appreciated. quote.js $(document).ready(function() { // create autocomplete $('#form-quote input[name=symbol]').typeahead({ // load autocomplete data from suggest.php source: function(query, callback) { $.ajax({ url: '../suggest.php', type: 'POST', dataType: 'json', data: { symbol: query }, success: function(response) { callback(response.symbols); } }); } }); // load data via ajax when form is submitted $('#form-quote').on('click', function() { // determine symbol var symbol = $('#form-quote input[name=symbol]').val(); // send request to quote.php $.ajax({ url: 'quote.php', type: 'POST', data: { symbol: symbol }, success: function(response) { $('#price').text(response); } }); return false; }); }); quote.php <?php //configuration require("../includes/config.php"); //if form was submitted if($_SERVER["REQUEST_METHOD"] == "POST"){ $stock = lookup(strtoupper($_POST["symbol"])); if(empty($_POST["symbol"])){ //echo "You must enter a stock symbol"; }else if($_POST["symbol"]){ $price = number_format($stock['price'], 2); echo "A share of {$stock['name']} costs $$price"; } } else{ // render portfolio render("stock_search.php", ["title" => "Get Quote"]); } ?> quote_search.php <form id = "form-quote" action="quote.php" method="post"> <fieldset> <div class="control-group"> <input name="symbol" autofocus autocomplete="off" placeholder="Symbol" type="text"/> </div> <div class="control-group"> <button type="submit" class="btn">Get Quote</button> </div> </fieldset> <div id="price"></div> <div id="suggestions"></div> </form> <script type="text/javascript" src="js/quote.js" ></script> quote_search.php <form id = "form-quote" action="quote.php" method="post"> <fieldset> <div class="control-group"> <input name="symbol" autofocus autocomplete="off" placeholder="Symbol" type="text"/> </div> <div class="control-group"> <button type="submit" class="btn">Get Quote</button> </div> </fieldset> <div id="price"></div> <div id="suggestions"></div> </form> <script type="text/javascript" src="js/quote.js" ></script> suggest.php <?php // configuration require("../includes/functions.php"); // if form was submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // load suggestion data $data = @file_get_contents("http://d.yimg.com/aq/autoc?query= {$_POST['symbol']}&region=US&lang=en-US&callback=YAHOO.util.ScriptNodeDataSource.callbacks"); // parse yahoo data into a list of symbols $result = []; $json = json_decode(substr($data, strlen('YAHOO.util.ScriptNodeDataSource.callbacks('), -1)); foreach ($json->ResultSet->Result as $stock) $result[] = $stock; echo json_encode(['symbols' => $result]); } ?>
  13. Hello good day, I've got here a code for countdown: var times = 50; function startCountdown() { if((times - 1) >= 0){ times = times - 1; $("#refreshTime").html('Auto logout: ' + times); setTimeout(startCountdown, 1000); }else{ //alert('Your session has ended!'); } } But my problem is, I got no idea on function that will reset the time when some click or hover the html body page. Thanks and regards!
  14. I have a function called after some data and the function is given below:- now the problem here is that at the #vote replace the color of the text is not assigned as it should be from where it is loaded I.e it is not red and not as the font size it should be. sorry this could be simple but not getting it. I have also tried to give .css to vote but it is still not applying that function attach() { var id="<?php echo $_REQUEST['id'];?>"; var state="<?php echo $_REQUEST['state'];?>"; $.ajax({ url: "petition_details.php", data: {id:id,state:state} }).done(function(result){ $("#spprt").replaceWith($(result).find("#spprt").html()); $("#vote").replaceWith($(result).find("#vote").html()); //The problem is here $("input[type=text]").val(""); $("textarea").val(""); if($("#ttt").text()=="You supported it before") { $('#ttt').css({'background-color':'#FFCC00','font-size':'16px','border-style':'none'}); } else if($("#ttt").text()=="Thank you for your VOTE") { $('#ttt').css({'background-color':'#00FF00','font-size':'16px','border-style':'none'}); } }); }
  15. Hello All, I am a new member on this forum. i am not a expert, but i want to design a product filter like this image. Please help me in this Issue. better if available in client side scripting.. Thanks in Advance..
  16. I am not entirely sure what this is called, but say for example you have some text on a site, and you want to edit it right there and then, and you just click on the text, and it changes to a text field and you edit the text, then onblur it updates the text with the new content form the text field. What is this called, and what is the best and easiest method of doing it?
  17. Hi guy I hope someone can help with this as im really panicking over it. Ok so im building my first CMS ever! Its about 5 months down the line. Im self taught so making lots of mistakes but im getting there. From the beginning I've been using..... http://caroufredsel.dev7studios.com/ for image scrollers and such. Works great!!!!!! I highly recommend!!!!!!! Basically I've come to check my webpage and it looks great. my images scroll and my services scroll. Ive checked it in Crome, firefox, safari, IE8, IE9 and it looks great. However load it in IE7 and real problems occur. It seems all my CSS to do with the carousel boxes just gets completely ignored! As much as i dont want to show a site that is working in a awful state with broken links and text im afraid ill have to for the purpose of this post. Please view the site in any browser then view it in IE 7 and you will see what I mean. wooden.yourarena.co.uk/ I have the code for the scroller below. $(document).ready(function() { $("#servicescroller").carouFredSel({ width: "100%", responsive: true, circular:true, infinite:true, height: 340, items: { visible: { min: 3, max: 4 }, width: 220, height: "variable", }, scroll: { duration: 1000, items: 1, pauseOnHover: true }, auto: 4000, swipe: true, mousewheel: true }); $("#foo<?php echo $row['randname'];?>").carouFredSel({ prev : { button : "#foo_prev", key : "left", items : 1, easing : "easeInOutCubic", duration : 750 }, next : { button : "#foo_prev", key : "right", items : 1, easing : "easeInQuart", duration : 1500 }, width: 500, height: 245, items : { visible :1, minimum: 1, width: 500, height: 250, }, direction : "up", scroll : { fx: "crossfade", pauseOnHover: true, }, auto : { duration : 2000, timeoutDuration: 5000, delay: 3000, pauseOnEvent: 'resume', } }).find(".<?php echo $row['randname'];?>").hover( function() { $(this).find("div").slideDown(); }, function() { $(this).find("div").slideUp(); } ); }); I have tried every combination of trailing comma's with and without and nothing seems to fix it. I can only assume something else on the page is interfering but I cant see what. I have used this scroller over and over and never had this problem. Can someone please at least tell me a way to debug the error or to even find what the error is. Im in dyer need of help as I have deadlines coming up which I am already way too far behind and I have no clue what the problem is. Thanks for your time guys
  18. I am stuck at this code I am using the jquery to load a entire id which works ok without live but for some reason I need to add live, But after using it the whole document buttons fail to work please help with this. $(document).ready(function(){ $("#td3 a").live("click",function(e){ var id=$(e.target).text(); $("#td1").load("pending_approvals.php #td1",{page:id}); }); }); <tr> <td id="td3"> Enter View Limit:<input type="text" name="limit" /> Pages>> <?php for ($i = 1; $i <= $total_pages; $i++) { echo "<a href='#'>$i</a> "; } ?> </td> </tr>
  19. I'm trying to use ajax to show upload progress bar. I downloaded a plugin and created a single php file and it works fine. However it doesn't work if the code is being included by another php file. Does anybody have an idea what the problem might be? Thanks.
  20. It may be my lack of ability to think straight because I have a cold and couldn't sleep but this makes no sense to me. I got an up/down voting script from here: http://www.9lessons.info/2009/08/vote-with-jquery-ajax-and-php.html I wanted to integrate it into a project that allows logged in users to vote. Each user gets one vote (up or down) per item being voted on but can change their vote. To do so I keep a table with user_id, item_id, up_vote (bool), and down_vote( bool). If a voter votes the yes or no that they voted for is incremented. If they later change their vote, the prior vote counter (up or down) is decremented and the new vote is incremented. A new vote that duplicates the users existing vote is ignored. Here's the client side code: $(function() { $(".vote").click(function() { var id = $(this).attr("id"); var name = $(this).attr("name"); var dataString = 'id='+ id ; var parent = $(this); if(name=='up') { $(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">'); $.ajax({ type: "POST", url: "updown/up_vote.php", data: dataString, cache: false, success: function(html) { parent.html(html); } }); } else { $(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">'); $.ajax({ type: "POST", url: "updown/down_vote.php", data: dataString, cache: false, success: function(html) { parent.html(html); } }); } return false; }); }); </script> I got that all to work, but the code that returns the up or down vote counter only returns the counter for the current vote (up or down) so I needed change the code server side to return two values in case the opposite vote was decremented and the client side code to display both. I changed the server side so that I get back data as json - for example now in my working Up_vote script I get: {"upvalue":"13","downvalue":"38"} instead of just a 13. So, now comes the hard part. I want to display 13 in the up box and 38 in the down box. I go to look at how to get the equivalent down box my up box and find that both boxes have the same id="1" (which is not legal) so I can't use getElementbyID one has name="up", the other name="down", but I can't use that because I have ids 2, 3, 4,... each with its own up and down. Both have the same class "vote". So, I decide to fix the non-unique IDs so I make the IDs 1 into 1-up and 1-down. Now, I need to trim the -up off before my AJAX call to up_vote and have my script know that 1-down is where it needs to put the down value. So I try this: $(function() { $(".vote").click(function() { var id = $(this).attr("id"); var name = $(this).attr("name"); var parent = $(this); if(name=='up') { var idtrim = id.replace('-up',''); var dataString = 'id='+ idtrim ; var oppid = idtrim + '-down'; var opposite = getElementbyid(oppid); $(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">'); $.ajax({ type: "POST", url: "updown/up_vote.php", data: dataString, cache: false, success: function(html) { parent.html(html); // opposite.html(html.down_votes) } }); alert (html); } else { var idtrim = id.replace('-down',''); var dataString = 'id='+ idtrim ; $(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">'); $.ajax({ type: "POST", url: "updown/down_vote.php", data: dataString, cache: false, success: function(html) { parent.html(html); } }); } return false; }); }); and I get nothing back. The alert (html) never shows. using alerts to debug dataString is: "id=1" oppid is: "1-down" I updated from jquery 1.2.6 to 1.8.1. I can run the server side script directly and it works. If I change the last lines of the server side code to just echo WOW it works in the first javascript but not the second. What obvious stupidity am I missing?
  21. Hello, I am will create now a button that will merge and split table cells. This is my code on generating tables <?php $out = "<table id='sheet' class='excel' cellspacing='0'><thead><tr>"; $out .= "<th></th>"; for ($i='a',$x=0; $x<26; $x++,$i++){ $out .= "<th>".strtoupper($i)."</th>"; } $out .= "</thead><tbody class='row-data'>"; for($a=1;$a<=50;$a++){ $out .= "<tr>"; $out .= "<th>$a</th>"; for ($i='a',$x=0; $x<26; $x++,$i++){ $out .= "<td id=".strtoupper($i).$a."></td>"; } $out .= "</tr>"; } $out .= "</tbody>"; $out .= "</table>"; echo $out; ?> Can anyone give me an Idea how will I going to start on that or some functions that I needed. I'm just a starter on jquery.
  22. I've got this use this ajax and json to pass the value of a table to server side PHP: $.ajax({ type: "POST", url: "json1.php", dataType: 'html', data: { json_1 : JSON.stringify(newArray), json_2 : JSON.stringify(newArray1) ,'key' : fileKey}, success: function(response){ $('#output').html(response); } }); on the server side I have no problem, but returning the value I've got this error Catchable fatal error: Object of class PHPExcel_Writer_Excel2007 could not be converted to string from blah blah blah I can't figure out what is the problem. Maybe its the JSON cause its converting the html element to JSON, but I already decode it on the server side $jsonData1 = json_decode($jsonData_1); $jsonData2 = json_decode($jsonData_2);
  23. <input type='submit' class='set' id='set' value='Set'/> <input type='text' class='mytext' id='mytext' style='font-style:italic'/> $('#set').click(function(){ $(cellId).css('font-weight','bold'); }); What I want to happen is when I click a button it make the text bold and if the text is already bold when I clicked it again it will remove the font-weight style attribute only. Using jquery. .
  24. Can anyone give me an idea on how I will count the table column and table row and get the id, attribute and the content of a each cell (the cell is contenteditable). What tools i have to use. e.g. <table id='sheet'> <tbody> <tr> <td id='1A' rowspan=2>Rowspan 2</td> <td id='1B'>22222</td> <td id='1C'>33333</td> </tr> <tr> <td id='2B' colspan='2'> Colspan2</td> </tr> <tr> <td id='3A' style='color:red'>Whaterver</td> <td id='3B' style='font-weight:bold'>Askyourmother</td> <td id='3C'>sigh</td> </tr> </tbody> </table> I'm using PHP and Jquery(Javascript). Thanks. .
  25. mainpage.php, loginModal.php, signInvalidate.php I have a page has a button that when click a modal dialog box pop up, the content of the modal is from other page(loginModal.php) using jquery .load, so the content now of the modal is a login form which validates using jquery ajax that send information to signInvalidate.php. I have no problem on validation it still return error if it is error, but if it is correct information I want to reload the main page. How will I do that? or does Jquery .load accepting return TRUE value. e.g. signInvalidate.php $result = $userFunction->checkLogin($useremail, @$password, @$remember, $gotUrl); if($result == TRUE){ return TRUE; } loginModal.php success: function(msg){ if(msg == TRUE){ return true; }else{ $("#signInOutput").html(msg); } } mainpage.php $('#previewOutput').load('modalLogin.php', function(){ });
  • 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.