Jump to content

Search the Community

Showing results for tags 'AJAX'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 123 results

  1. I have a problem with the jQuery AJAX Append function. Everytime I append a comment to the <span>, not only does it append that single one, but also replicates every other comment dynamically generated by the PHP. So I end up with multiple repeated comments. However, the repeated comments aren't stored in the database, so whenever I refresh the page, it goes away. How can I prevent this without refreshing the page everytime? PHP: To display all comments <span id="commentHint"></span><?phpecho "<b>$comment_user said:</b><small>$comment_time</small><br>"; echo "$comment<br>";?> AJAX: Comment On Submit <script> $(document).ready(function () { var form = $('#form'); var submit = $('#submit'); form.on('submit', function (e) { // prevent default action e.preventDefault(); // send ajax request $.ajax({ url: 'commentpost.php', type: 'POST', cache: false, data: form.serialize(), beforeSend: function () { // change submit button value text and disabled it submit.val('Submitting...').attr('disabled', 'disabled'); }, success: function (data) { var item = data; $('#commentHint').append(item); //Appends it to div. form.trigger('reset'); submit.val('Submit Comment').removeAttr('disabled'); }, error: function (e) { alert(e); } }); }); });</script>
  2. Please Add the Petrojs Tutorial
  3. Hello, I'm trying to reload only a script instead of entire page. And I want to apply it in an ajax script. How could I do that? My web contains a map(script of openlayers) and I put data into the map. So when I remove this data by a button I would like reload only the map. Here is my code. It only shows an alert if the object has been removed or not: // Autor: @jqcaper// Configuraciones Generalesvar nombre_tabla_pozos = "#tabla_pozos"; // idvar nombre_boton_eliminar_pozo = ".deletepozo"; // Clasevar nombre_formulario_modal_pozo = "#frmEliminarpozo"; //idvar nombre_ventana_modal_pozo = "#pozoModal"; // id// Fin de configuraciones$(document).on('ready',function(){ $(nombre_boton_eliminar_pozo).on('click',function(e){ e.preventDefault(); var Pid_pozo = $(this).attr('id'); var name_pozo = $(this).data('name'); $('#modal_idPozo').val(Pid_pozo); $('#pozo_name').text(name_pozo); }); var options_pozo = { success:function(response) { if(response.status=="True"){ alert("¡Object removed!"); var idPozo = response.pozo_id; var elementospozo= $(nombre_tabla_pozos+' >tbody >tr').length; if(elementospozo==1){ location.reload(); }else{ $('#tr'+idPozo).remove(); $(nombre_ventana_modal_pozo).modal('hide'); } }else{ alert("¡There was an error when remove!"); $(nombre_ventana_modal_pozo).modal('hide'); **RELOAD SCRIPT }; } }; $(nombre_formulario_modal_pozo).ajaxForm(options_pozo);}); Thank you very much!
  4. Hi All,I'm developing a basic website and have a question. Hope it's not too much basic. I'm new in web stuff.I have the following code: $.ajax({url: '/blabla/yadayada'type: "get",success:function(data, testStatus, jqXHR){.........},error: function(jqXHR, testStatus, errorThrown){alert('error')}}); In addition, i have the following Python code: class AfCont(object):def __init__(self, target, context):self.target_server = targetself.context = contextself.baseContext = "/MyApp%s" % ( ("-" + self.context) if self.context else "")print "Starting %s with server: %s " % (self, self.target_server)def general_url(self, url_sfx):headers = {"Accept": "application/json"}params = Nonethe_url = "%s/%s" % (self.baseContext, url_sfx)print "%s %s %s " % (self, self.target_server, the_url)conn = httplib.HTTPConnection(self.target_server, "8080")conn.request("GET", the_url, params, headers)response = conn.getresponse()theResp = response.read()return theResp@cherrypy.exposedef bla_yada(self):htmlText = self.general_url("blabla/yadayada")return htmlText As you can see in the Ajax code, my URL is /blabla/yadayada. However, i need to send GET requests to /blabla/yadayada/number. I want to control the number part with a parameter. For example: number = 150 -- > `/blabla/yadayada/150`number = 9595-- > `/blabla/yadayada/9595` Can someone help me with that? Hope i was clear enough.
  5. Hello, I need delete row in html table select row and click button delete make delete using ajax Currentally can make delete without ajax but I need delete row and stay on page without make submit on other page code html,php <?php $resualt=mssql_query("SELECT * FROM Address where user_id='$UserId' ") ;echo "<table border='1' class='imagetable' id='imagetable'width='400px' >n";echo '<thead>'.'<tr>';echo '<th>Street</th>'.'<th>Quarter</th>'.'<th>From</th>'.'<th>To</th>'.'<th>Notes</th>';echo '</tr>'.'</thead>';echo '<tbody>';while ($row = mssql_fetch_assoc($resualt)) {$fromDate=$row['from_date'];$toDate=$row['to_date'];echo " <tr onClick='myPopup($row[id])'". ( $_GET['id'] == $row['id'] ? "style='background-color: green;'":"").">n"."<td >{$row['street']} </td>n"."<td>{$row['quarter']}</td>n"."<td>$fdate2</td>n"."<td>$tdate2</td>n"."<td>{$row['other_info']}</td>n";}echo '</tbody>';echo "</table>n";?> //button delete <?phpecho"<a class='button-link' href='delete_address.php?id=$id'>delete</a>"; ?> code sql to make delete from db <?php$idEmploye=$_GET['id'];$db_host = 'jo';$db_username = 'jo1';$db_password = '123321';$db_name = 'db_test';mssql_connect($db_host, $db_username, $db_password);mssql_select_db($db_name);mssql_query("DELETE FROM AddressWHERE id='$idEmploye' ; ") or die(mssql_error()) ;echo '<script language="javascript">';echo 'alert("successfully deleted ")';echo '</script>';echo "<script>setTimeout("location.href ='address.php';",10); </script>"; ?> Any Help Thanks
  6. function getXMLHttp(){ var xmlHttp; try { //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Your browser does not support AJAX!") return false; } } } return xmlHttp;}function populateEntries(menu, userName, entryRow){ var xmlHttp = getXMLHttp(); xmlHttp.onreadystatechange = function() { if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200) && (xmlHttp.responseText == "")) { window.alert("There are no records to view!"); } else if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200)) { var response = xmlHttp.responseText;// window.alert("PHP Response = '"+response+"'"); } } xmlHttp.open("GET", "getUsers.php", true); xmlHttp.send(null);// ADDITIONAL UNRELATED CODE THAT PARSES THE “RESPONSE,” CREATING A MULTIDIMIENSIONAL ARRAY, WHICH POPULATES A SELECT INPUT FOLLOWS ....} I am using an AJAX call from a javascript to populate a SELECT input. This script is not working as shown in the code excerpt below. However, when I insert an alert of any type at the location shown by the comment, it works as planned. What could be causing this? I've also tried, without success, inserting a delay function after the AJAX call to allow time for the response to be returned (even with the readystate and status tests shown). Any suggestions as to how I can get this to work as desired?
  7. hi thereplease be noted that i need help with the code found on w3schools regarding fetching data from mysql dbase using php and ajax and im using 2 files one is html and second one is phpi used the 2 codes below but when i select a user all i get is this please see below :Firstname Lastname Age Hometown Job "; while($row = mysql_fetch_array($result)) { echo ""; echo "" . $row['FirstName'] . ""; echo "" . $row['LastName'] . ""; echo "" . $row['Age'] . ""; echo "" . $row['Hometown'] . ""; echo "" . $row['Job'] . ""; echo ""; } echo ""; mysql_close($con); ?>Note : that i have created the same database suggested i just wanted to try that and see if it works and then proceed with my own database and tablesNote : my database is :testmy table is :userHTML CODE :---------<html><head> <script>function showUser(str) { if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("txtHint").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET","getuser.php?q="+str,true); xmlhttp.send(); }}</script></head><body><form><select name="users" onchange="showUser(this.value)"> <option value="">Select a person:</option> <option value="1">Peter Griffin</option> <option value="2">Lois Griffin</option> <option value="3">Joseph Swanson</option> <option value="4">Glenn Quagmire</option> </select></form><br><div id="txtHint"><b>Person info will be listed here.</b></div></body></html>---------------------PHP CODE :=========<?php$q = intval($_GET['q']);$con = mysql_connect('localhost','root','','test');if (!$con) { die('Could not connect: ' . mysql_error($con));}mysql_select_db("test",$con);$sql="SELECT * FROM user WHERE Id = '".$q."'";$result = mysql_query($con,$q);echo "<table border='1'><tr><th>Firstname</th><th>Lastname</th><th>Age</th><th>Hometown</th><th>Job</th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>";}echo "</table>";mysql_close($con);?>
  8. In my previous question I managed to solve a way to load an external php file into my html thanks to your help. The php file loads perfectly fine as long as it follows the simple to criteria to load php after a given amount of time, which in my case is 1000 milliseconds. I wanted to know a method which loads data from the php file ONLY, and ONLY if the data in that php file has changed. My script what I managed to do after hours of research looks like follows: <script type="text/javascript">$(document).ready(function () { var auto_refresh = setInterval( function () { function testing() { var result = null; var scriptUrl = "http://localhost:8888/test-site/wp-content/my-php-files/test-check.php"; //Use this php file (NB: This file contains the same data as "test.php") as a check if data changed or not. $.ajax({ url: scriptUrl, type: 'POST', // I tried "GET" as well dataType: 'html', success: function (data) { result = data; } }); return result; } databaseData = testing(); currentData = $('#demo').html(); if (databaseData != currentData) { // I compare the values from the Ajax request and the value currently in my div to see if they are similar or not. $('#demo').fadeOut('slow', function () { // I added fadeOut and FadeIn effect for the div to load when data has changed $('#demo').load('http://localhost:8888/test-site/wp-content/my-php-files/test.php', function () { $('#demo').fadeIn('slow'); }); }); } }, 1000);});</script><div id="demo"></div> In this case scenario, the problem is that the div is loaded every second with the fadeIn and FadeOut effect although the data has not changed. Precisely, the same value appears even up to ten times with the effects even if it is the same value the whole time. It does not matter, if the value is altered or not, the div will be refreshed anyway. The php file contains some data (to pe precise prices) that are refreshed in a random amount of time (it can be 1 second, 10 seconds, 1 minute, etc; this is uncertain). Is there a way to compare the data in "test.php" and if it is not the same, upload the div with the new content? Thanks once again!! This forum always gives great support and positive feedback.
  9. edit ---- (sorry for spelling mistake on topic. its "special" in stead of "sepcial") I've created ajax request to get some data. I works fine for normal data but if it contains special character like "&", then it does nothing. following is the ajax request---- function getSid(){var XMLHttpRequestObject = false;if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest();} else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");}XMLHttpRequestObject.onreadystatechange = function(){ if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { document.getElementById('sid').value = XMLHttpRequestObject.responseText; }}var item = document.getElementById('item').value;XMLHttpRequestObject.open('POST', 'ajax/sid.php');XMLHttpRequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");XMLHttpRequestObject.send("item=" + item);} and this is the page that I derive data from--- <?php##################### sid.php #####################require_once('../functions.php');header("content-type: text/xml");$item = ($_POST['item']); // this works fine if I put $item = 'this & that' but if I send the same value from ajax, it doesn't work.if ($stmt = $mysqli->prepare("SELECT sid FROM stock WHERE item=? AND cid=?")) { $stmt->bind_param('si', $item, $cid); $stmt->execute(); $stmt->bind_result($sid); $stmt->fetch(); echo $sid;} else { echo 'error: '.$mysqli->error;}?> please help resolving this problem-----
  10. Hi guys,my problem is that in ie11 my dynamic drop down select list not showing at all!!,, i mean that in firefox and chrome is working except ie11,, i m using append method like that, function loadUsagesDdl(ajaxUrl) { var reportsUrl = $(document).myfunctions('reportsUrl'); $.ajax({ dataType:'json', type: 'GET', url: ajaxUrl, cache:false, success:function (response) { var ddl = $('#ddl_usageCode'); var opts = response.Records; $.each(opts, function(i, item) { // ddl.append($("<option />").val(item.usageCode).text(item.description)); $("<option></option>",{ value: item.usageCode, text: item.description }).appendTo(ddl) }); var firstUsageCode = response.Records[0].usageCode; loadDynamicDdl(reportsUrl + '/ddlPaymentPeriods?usageCode=' + firstUsageCode, 'ddl_periodFrom'); loadDynamicDdl(reportsUrl + '/ddlPaymentPeriods?usageCode=' + firstUsageCode, 'ddl_periodTo'); }, error:function (jqXHR, exception) { alert("There was an error loading dropdownlist."); } });} what is going wrong in ie? please guys any help would be really appreciated..Thank you all
  11. Dear all, some help will be highly appreciated. I have a JS code that has a form for first name and last name. Ajax then communicates with a PHP script and gets back a message from PHP that thanks the user by stating the first and last names of user. The PHP message will show at the bottom of the form without having the page to refresh. The PHP message ensures a successful communication between JS and PHP via Ajax. The JS script:<!DOCTYPE html><html lang="en"><head><script>function ajax_post() {//create our XMLHttpRequest objectvar hr = new XMLHttpRequest();//create some variables we need to send to our PHP filevar url = "my_parse_file.php"; //name of the PHP parsing script.var fn = document.getElementById("first_name").value;var ln = document.getElementById("last_name").value;var vars = "firstname="+fn+"&lastname="+ln; //variables to be sent to PHP scritp.hr.open("post", url, true); //using the open method on XMLHttpRequest object.hr.setRequestHeader("Content_type", "application/x-www-form-urlencoded");// access the onreadystatechange event for the XMLHttpRequest object.hr.onreadystatechange = function() {if (hr.readyState == 4 && hr.status == 200) {var return_data = hr.responseText;document.getElementById("status").innerHTML = return_data;}}// send the data to PHPhr.send(vars);document.getElementById("status").innerHTML = "processing...";}</script></head><body><h2>Ajax Post to PHP and Get Return Data</h2>Your First Name: <input id="first_name" name="first_name" type="text" /><br /><br />Your Last Name: <input id="last_name" name="last_name" type="text" /><br /><br /><input name="myBtn" type="submit" value="Submit Data" onClick="javascript:ajax_post();" /><br /><br /><div id="status"></id></script></body></html>The PHP script:<?phpecho 'Thank you ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . ',says the PHP file.';?>I receive no message back from the PHP script as desired, only the word "processing...".As part of the debugging, I inserted:document.write("Ready State = "+hr.readyState + " Ready Status = "+hr.status);after: hr.onreadystatechange = function() {The message I got was: Ready State = 4 Ready Status = 0.I thought it meant changing the 200 to 0, but still didn't work.My system: Apache, PHP 5.5.9, Windows 64-bit OS, Windows 7
  12. Hi, what is the 'q' thing in this PHP AJAX tutorial: http://www.w3schools.com/php/php_ajax_php.asp : HTML page: xmlhttp.open("GET","gethint.php?q="+str,true); PHP file: $q=$_REQUEST["q"]; And how PHP read value of an input element (html) to be processed? The same question if using jquery AJAX.. I'm learning XMLHttpRequest and trying to figure out how PHP get data value from HTML element to be processed. I don't know anything about PHP, I've just started a start. Thanks!
  13. On home page [Website link] there is sliding celebrity Images : on click of any celebrity it takes to it resp. pages which is working on Desktop / laptop browser , i mean click - link working , but same if i open in Any Cell Phones then `sliding images` is shown but `images` is `not click able` and it not going to resp. page of celebrity.I am using `wp-roundabout-pro` ( https://wordpress.org/plugins/wp-roundabout-pro/ ) plugin in my website ( `WordPress 3.8.4` )i know the plugin is not support to current version of my word-press... but In Desktop / laptop browser all working prefect.any idea what is the issue. please help me out... as if this issue is not short-out then my whole work will be wasted Below is plugin code : <?php $anims = array('lazySusan', 'waterWheel', 'figure8', 'square', 'conveyorBeltLeft', 'conveyorBeltRight', 'diagonalRingLeft', 'diagonalRingRight', 'rollerCoaster', 'tearDrop', 'theJuggler', 'goodbyeCruelWorld'); if(!in_array($animation, $anims)){ $animation='conveyorBeltLeft'; $asclass = ''; } else { $asclass = 'class="hideflow"'; } $sid = 'rbt-'.uniqid(); $out = '<ul '.$asclass.' id="'.$sid.'">'; $fwidth = intval($data[opt1]); $fheight = intval($data[opt2]); while($row = mysql_fetch_assoc($res)){ if($row[url]!='' && trim($row[url])!=' '){ $img = '<img src="'.get_image_thumb($row[url], 'w='.$fwidth.'&h='.$fheight).'" />'; } else { $img = ''; } if($row[title]!='' && trim($row[title])!=' '){ //$ttlxz='<span class="rbt-title"><span>'.$row[title].'</span></span>'; $ttlxz=''; } else { $ttlxz=''; } if($row[desc]!='' && trim($row[desc])!=' '){ //$descxz='<span class="rbt-content"><span>'.$row[desc].'</span></span>'; $descxz=''; } else { $descxz=''; } $out = $out.'<li style="background-color:'.$row[color].'">'.$ttlxz.''.$descxz.'<a href='.$row[desc].'>'.$img.'</a></li>'; } $out = $out.'</ul> <style type="text/css"> #'.$sid.' { list-style: none; padding: 0; margin: 0 auto; width: '.$data[opt5].'px; height: '.$data[opt6].'px; } #'.$sid.' .roundabout-moveable-item { height: '.$fheight.'px; width: '.$fwidth.'px; background-color: '.$data[opt4].'; text-align: left; cursor: pointer; overflow:hidden; } </style> <script> jQuery(document).ready(function() { jQuery("#'.$sid.'").roundabout({ autoplay: '.$data[opt7].', autoplayDuration: '.$data[opt9].'000, minOpacity: '.$data[opt10].', maxOpacity: '.$data[opt11].', reflect: '.$data[opt12].', enableDrag: '.$data[opt13].', dragAxis:"'.$data[opt3].'", shape: "'.$animation.'", autoplayPauseOnHover: '.$data[opt8].' }); }); </script> '; ?> Sample of HTML code generated : <div class="slider"> <ul id="rbt-5428f4c10c934" class="hideflow roundabout-holder" style="padding: 0px; position: relative;"> <li style="background-color: rgb(238, 238, 238); position: absolute; left: 684px; top: 58px; width: 137.19px; height: 82.314px; opacity: 0.19; z-index: 117; font-size: 6.4px;" class="roundabout-moveable-item"> <a href="http://www.thefansworld.com/celebfanpage/shahrukh-khan/"> <img src="http://www.thefansworld.com/wp-content/plugins/wp-roundabout-pro/cache/w=300&h=180___Shahrukh-Khan-Magazine-Photoshoot.jpg"> </a> </li> </ul> </div> I taught my a link have some issue but my anchor link is seem to be perfect then why its not working in mobile phones. Also one user told me that on his/her mobile phone its working but i have checked in Samsung , Nokia , Sony ,Tabs all phones ..but its not working -- means image is not clickable ,where on desktop / laptop its working fine
  14. How can I use PHP Code for the links.xml file for the Live Search Script (http://www.w3schools.com/php/php_ajax_livesearch.asp). I have thousands of Links, which I want to be searchable. <?phpforeach ($verbs["a"] as $key => $list) {echo '<link>'."n";echo '<title>'.($verbs["a"][$key]).'</title>'."n";echo '<url>a/'.letter($verbs["a"][$key]).'/</url>'."n";echo '</link>'."n";} ?> I want also to know, how to change the script, because I want, that the first letter should be find only words, which starts which this letter and so on. like Search: A Alfred Andy Anna Astrid Search: An Andy Anna
  15. I am struggling from past 2 hours .Tried : location.reload(); reset form many features but after i close my popup and when reopen or open some another id ..my previous id data is still seen there and its continuous for all id. style : #overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; filter:alpha(opacity=70); -moz-opacity:0.7; -khtml-opacity: 0.7; opacity: 0.7; z-index: 100; display: none; } .content a{ text-decoration: none; } .popup{ width: 100%; margin: 0 auto; display: none; position: fixed; z-index: 101; } .content{ min-width: 800px; width: 900px; min-height: 150px; margin: 0px auto; background: #f3f3f3; position: relative; z-index: 103; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px #000; } .content p{ clear: both; color: #555555; text-align: justify; } .content p a{ color: #d91900; font-weight: bold; } .content .x{ float: right; height: 35px; left: 22px; position: relative; top: -25px; width: 34px; } .content .x:hover{ cursor: pointer; } Jquery / ajax :Below is my popup box + ajax to fetch and show record under Input field $('#class').on('click delegate mouseenter', 'a', function (e) { var data = dt.row( $(this).parents('tr') ).data(); var valuea = data[1]; $(function(){ e.preventDefault(); var table = $('#class').DataTable(); var overlay = $('<div id="overlay"></div>'); $('.close').click(function(){ $('.popup').hide(); overlay.appendTo(document.body).remove(); location.reload(); resetForms(); $("span.ajax_loader").hide(); // success var pathlaser = "server_processing_laser.php"; tablel.clear(); tablel.draw(); tablel.ajax.url(pathlaser).load(); return false; }); $('.xclose').click(function(){ $('.popup').hide(); overlay.appendTo(document.body).remove(); location.reload(); resetForms(); $("span.ajax_loader").hide(); // success var pathlaser = "server_processing_laser.php"; tablel.clear(); tablel.draw(); tablel.ajax.url(pathlaser).load(); return false; }); // POPUP BOX $('.click_'+data[0]+'').click(function(e){e.preventDefault(); overlay.show(); overlay.appendTo(document.body); $('.popup').show(); $("div.note_msg").hide(); $('.popup .id').val(valuea); // FETCHING DATA TO SHOW $.ajax({ type:"GET", url:"fetchrecord.php", data:{ valuea:valuea, }, async: false, success:function(html){ $("#display").after(html); } }); return false; }); }); }); }); **below is popup code :** <div class='popup'> <div class='content'> <a href='' class="xclose"><img src='../datatables/media/images/close.png' alt='quit' class='x' id='x' /> </a> <p> <form method="post" action="" id="feedback_form"> <div class="langtrx_fr" align="center"> <table align="center"> <div id="display"></div> </table> </div> </form> <span class="ajax_loader"></span> <table align="center"><tr><td> <a href='' class='close'><strong>Close</strong></a> </td></tr> </table> </p> </div> </div> fetchrecord.php $valuepktid = $_REQUEST['valuea']; $sql = "SELECT stoneone,stonetwo,stone3,loss FROM stone WHERE pid = ".db_escape($valuepktid)." GROUP BY id"; $resultpkt = mysqli_query($db,$sql); $abpkt = mysqli_fetch_array($resultpkt); ?> <?php header('Pragma: no-cache', true); header("Cache-Control: no-store, no-cache, must-revalidate", true); ?> <tr> <td class="label">Stone 1 :</td> <td class="form"> <input name="stoneone" id="stoneone" readonly value="<?php echo $abpkt['stoneone'];?>" class="stoneone" autocomplete="off" type="number"/> </td> </tr> <tr> <td class="label">Stone 2 :</td> <td class="form"><input name="stonetwo" readonly value="<?php echo $abpkt['stonetwo'];?>" class="stonetwo" autocomplete="off" type="number" /></td> </tr> <tr> <td class="label">Loss :</td> <td class="form"><input name="loss" readonly value="<?php echo $abpkt['loss'];?>" class="loss" value="" autocomplete="off" type="number" /></td> </tr> All is working fine.. i mean i am getting databut when i close and open any other ID , then popup show me above tr/td data twice.means the latest data and the old one which i closed.i tried reload of page so that i get fresh data, but some time its showing me proper data and some time multiple with old one.I think its something related to cache of DIV. which remain as its after close of popup.**popup link :** http://stackoverflow.com/questions/24902935/jquery-datatables-jquery-popup-box-not-working-under-function-php-mysqlany idea please help
  16. I want know what data will go to the server, when I click on save button of asp page without using update panel and using update panel .
  17. I am using Ajax File Upload control for uploading multiple files at same time. but i want use my own upload button (in my case save button) for uploading files not the ajax upload button. how can i do this ?
  18. I have 4 Column ( id (primary) , a, b ,c ,d ) --------------------------------------------------------------------------------------------------------------------------------ID | A | B | C ( where C = SUM B ) | D ( where D = C / A1 , Where A1 = 6 )-------------------------------------------------------------------------------|------------------------------------------------1 | 4 | 3 | 8 | 22 | 6 | 2 | | 3 | 1 | 3 | | -------------------------------------------------------------------------------|-------------------------------------------------- How i can display such table with pagination . Both A , B value are Input text Field , which entry are made by user side and its stored in Database table , but C value is addition of B (TOTAL) . where C = SUM B where D = C / A1 , Where A1 = 6 HENCE how i can get C,D as A,B coloumn get increment , and c,d will be calculation of it , hence how i can show such TABLE VIEW with Pagination . note : Not tried any thing , as i am bit confuse how to start
  19. Luciana


    Guys, good morning. I am looking for a long time this helps, I found this forum and hope I succeed in this quest is the following, http://studioplanoverde.com.br/site/ this link, or by clicking the PORTFOLIO menu, it goes to down in the page itself and show some pictures, and when you click on top of the image, it opens, it opens only remaining on the page itself, what I need and MUCH, is that when you open the image, it may rise slightly, why is paying attention, the image opens but gets half of the page, then you have to go down a little scroll rod. I finally found the file for this purpose, at first, seems a bit messy, but that's the way it is in the file, I'll post here. Since now, and very grateful for the attention and mostly anyone who can help me. /* Dynamic Window Ajax Portfolio Content */"use strict";(function($) {var $actual= null;var obert=false;$(".ch-grid").click(function() {obre($(this).attr('id'));$actual=$(this);});$(".folio-btn").click(function() {$(".project-window").slideUp("slow");obert=false;});//obre('portfolio-1.html',1);function obre(quin, dummy){$.ajax({url: quin,success: function(data) {$('.project-content').html(data);$(".project-content").hide(0)$('.project-window').hide(0)tanca();canvia();worksCarousel();if(dummy!=1){// if(obert!=true){$("html, body").animate({ scrollTop: $('#portfolio').offset().top }, 500, function(){$('.project-window').show(0);$('.project-window').animate({height:900}, 500,function(){$('.project-window').css('height','auto');// $(".project-window").slideDown(1500, function() {$(".project-content").fadeIn("slow");});});/* }else{$("html, body").animate({ scrollTop: $('#anchor5').offset().top }, 300, function(){$('.project-window').show(0);$(".project-content").fadeIn("slow");});}obert=true; */}}});}function tanca(){$(".close").click(function() {$('#portfolio').slideUp("slow");$('#portfolio').animate({ scrollTop: $('#portfolio').offset().top });obert=false;});}function seguent(){if($actual.next().hasClass('final')){$actual=$($('.inici').next());}else{$actual=$($actual.next());}if($actual.hasClass('isotope-hidden')){seguent();}else{obre($actual.attr('id'));}}function enrera(){if($actual.prev().hasClass('inici')){$actual=$($('.final').prev());}else{$actual=$($actual.prev());}if($actual.hasClass('isotope-hidden')){enrera();}else{obre($actual.attr('id'));}}function canvia(){$('.btn-next').click(function() {seguent();$("html, body").animate({ scrollTop: $('#project-show').offset().top }, 1000);});$('.btn-prev').click(function() {enrera();$("html, body").animate({ scrollTop: $('#project-show').offset().top }, 1000);});}// Carousel Project Openedfunction worksCarousel(){var totalWorks = $(".wrapper-project ul li").length;var ampleWork = $(".project-content").width();var ampleTotalWorks = totalWorks*ampleWork;$('.wrapper-project ul').css('width',ampleTotalWorks)$("html, body").animate({ scrollTop: $('#project-show').offset().top }, 1);var fragment = document.createDocumentFragment(),li = document.createElement('li');while (totalWorks--) {fragment.appendChild(li.cloneNode(true));}$('.controller-3 ul').append(fragment);var index3 = 0;var pos3 = 10;$('.controller-3 ul li:first-child').addClass('selected');$(".controller-3 ul li").click(function(){index3 = $(this).index();$(".wrapper-project").stop().animate({scrollLeft:ampleWork*index3},'slow');$('.controller-3 ul li').removeClass('selected');$(this).addClass('selected');//alert(ampleitem);});$(".w-next").click(function(){if( index3 != $(".controller-3 ul li").size()-1){ index3++; $(".wrapper-project").stop().animate({scrollLeft:ampleWork*index3},'slow'); pos3++; $('.controller-3 ul li.selected').removeClass('selected').next().addClass('selected');} });$(".w-prev").click(function(){ if( index3!=0 ){ index3--; $(".wrapper-project").animate({scrollLeft:ampleWork*index3},'slow'); pos3--; $('.controller-3 ul li.selected').removeClass('selected').prev().addClass('selected'); }});}})(jQuery);
  20. i learnt how to update single mysql row using jquery and ajax. now i want to learn how can i update multiple rows the same way. this was done to update one row -- var where_val = form.find('#where').val(); var where_col = form.find('#where').attr('name'); input.bind('blur', function(event) { var value = input.val(); $.ajax({ url: action, type: method, data: { val: value, col: column, w_col: where_col, w_val: where_val, }, to try if it works or not for updating multiple rows, i changed this to -- var where_val = form.find('#where').val(); var where_col = form.find('#where').attr('name'); var where1_val = form.find('#where1').val(); var where1_col = form.find('#where1').attr('name'); input.bind('blur', function(event) { var value = input.val(); $.ajax({ url: action, type: method, data: { val: value, col: column, w_col: where_col, w_val: where_val, w1_col: where1_col, w1_val: where1_val }, but somehow its not working. it is updating all the rows with the values of the last row. please guide me...
  21. i'm learning ajax along with javascript. while learning i'm trying something as responseText. what i tried works fine on CHROME version 36(dev) but doesn't work on Internet Explorer version 11. this is what i tried <head><script type="text/javascript">var XMLHttpRequestObject = false;if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest();} else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");}function getData(dataSource, divID){ if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); }}</script></head><body><table><tr><td><a id="note" href="javascript:getData('note.php?', 'note')" class="link">Note</a></td><td id="note"></td></tr></table> please help me find what i missed........
  22. Hi, I'm trying to let JavaScript check if a givin user exist in the database. It seems that the _check-user.php always returns 0, but if I fill in a name that doesn't exist, and echo out the result variable in JS, the echo will return 1. Is there someone who could help me? JavaScript part: function checkUser() { $.post("_check_user.php", { 'username': document.getElementById("username").value }, function(result) { if (result == 1) { document.getElementById("checkUser").className = "succes"; document.getElementById("checkUser").innerHTML = "Name is available"; }else{ document.getElementById("checkUser").className = "errormsg"; document.getElementById("checkUser").innerHTML = "Name is not available!"; } });} _check-user.php: <?phpinclude("config.php");$result = mysql_query("SELECT login FROM users WHERE login='".clean_string($_POST["username"])."'");if(mysql_num_rows($result)>0){ echo 0;}else{ echo 1;}?>
  23. Hi everyone, I am facing a crisis here. I have a textbox, named businessInfo_businessAddress, which contains client's address loaded from the database when the page is loaded. I have a hidden field, named tracking-select-business-country-code <input type="hidden" id="tracking-select-business-country-code" value=""/> which is supposed to store the country code after the google map api is called. In the included javascript file, where the google map api is called, I have piece of code like this function getCountryCode(targetAddress){ console.log("in function getCountryCode"); var input = document.getElementById(targetAddress); var autocomplete = new google.maps.places.Autocomplete(input); console.log("autocomplete: "); console.log(autocomplete); var lat = "37.09024"; var lng = "-95.71289100000001"; console.log("before calling google map api"); google.maps.event.addListener(document, 'load', function () { console.log("after calling google map api"); var place = autocomplete.getPlace(); if (!place.geometry) { return; } lat = place.geometry.location.lat(); lng = place.geometry.location.lng(); var address_components = place.address_components; console.log("address components: "); console.log(address_components); var country_code; for(var i=0; i< address_components.length; i++) { var address_component = address_components[i]; if((typeof address_component !== "undefined") && (typeof address_component.types !== "undefined")){ if(address_component.types[0] == "country") { country_code = address_component.short_name; } } } country_code = $.trim(country_code); console.log("country code:'" + country_code + "'"); $('#tracking-select-business-country-code').val(country_code); }); }function _webGetCountryCode(){ console.log("in function _webGetCountryCode"); getCountryCode("businessInfo_businessAddress");} And in document.ready I have a piece of code that trying to call that function like this <script> $(document).ready(function () { var oldAddress = $("#businessInfo_businessAddress").val(); $('#tracking-select-address').val(oldAddress); var country_code = $("#tracking-select-business-country-code").val(); if(country_code == "" || country_code == null) { console.log("country code is empty"); google.maps.event.addDomListener($("#businessInfo_businessAddress"), 'focus', _webGetCountryCode); $("#businessInfo_businessAddress").focus(); getCountryCode(); } var country_code = $("#tracking-select-business-country-code").val(); console.log("country code (when loaded): " + country_code); ............... </script> I got this error in console.log Uncaught TypeError: Cannot read property 'value' of null I guess it must have something to do with variable autocomplete (just guessing). Anyway, what I need is that after the form finishes loading (ie. $(document).ready is called), google map api must be called with the value contained in the textbox businessInfo_businessAddress (for example: "Atlanta, GA, United States") and return the country code for hidden field tracking-select-business-country-code. I wonder how can I do that? Any idea? What change do I need to make in the code? Please help!!!! Thanks everyone.
  24. What I'm trying to do is use an xml DOM created in php to display on my webpage using an ajax call. I'm pretty sure this is a JavaScript problem, but it's possible there may be an issue with my php code. Part of the php code is below if needed. The reason I believe the php code is fine, is because if I go directly to the page and uncomment the saveHTML() line, it displays fine. The first code below is my ajax call. I think the call fails, because what I get is the alert error message in my code (An error has occured). I'm not sure what the issue is. Thanks for any suggestions. request = $.ajax({ url: "results.php", type: "POST", dataType: "xml" }).done(function (data){ $(data).find("stat").each(function(){ $("result").append($(this).find("fName").text() + "<br>"); }); }).fail(function (){ alert("An error has occured."); }); $result=mysqli_query($con,$cmd);$doc = new DOMDocument("1.0", "utf-8"); $root = $doc->createElement('stats'); $doc->appendChild($root); while($row=mysqli_fetch_array($result)){ // Creates the main xml element stat $element = $doc->createElement("stat"); // Declares variables from SQL table to be used for sub-elements $fName = $row['fName']; $lName = $row['lName']; $position = $row['position']; $pYard = $row['pYard']; // Create sub-elements $pfName = $doc->createElement("fName", $fName); $plName = $doc->createElement("lName", $lName); $pPosition = $doc->createElement("position", $position); $pPYard = $doc->createElement("pYard", $pYard); // Add sub-elements to main element stat $element->appendChild($pfName); $element->appendChild($plName); $element->appendChild($pPosition); $element->appendChild($pPYard); // Add main element to root $root->appendChild($element); } //echo $doc->saveHTML(); echo $doc;
  25. I am using tab container from ajax toolkit for asp.net. i want to set background color for tabpanel's header area. how i can do it ?
  • Create New...