Jump to content

Search the Community

Showing results for tags 'AJAX'.

  • 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








  1. 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 ?
  2. I want to use TabControl from AjaxToolkitcontrol in Asp.Net, for that i have downloaded Ajaxcontroltoolkit.dll & using this into toolbox of visual studio. so when i Drag & Drop any Ajax control from toolbox on to webform and try to run it. whole visual studio 2010 application hangs. i think that, ajaxcontroltoolkit version is not matching with my visual studio's .NET framework. so i have tried Ajax toolkit control version from 3.5, 4.1& 4.5 while i am working with .Net Framework version of 4.0. but still application hangs. please let me know any possible solution
  3. hello, I am trying pass values ​​from ajax to php without refresh the page, I have a drop down list, and when I choose an option,I want send a value to ajax . now to change values in the "form", I want, the value who I have send to the ajax transform in php variable. PHP: <? $result = mysql_query("SELECT id_subuniverso, subuniverso, ref FROM tbl_sub_universo ORDER BY subuniverso ASC"); echo'<select name="sub_uni" id="subuniverso" onchange="show();"> <option value="0" size="35">..........Seleccione o Sub-Universo..........</option>'; while( $row = mysql_fetch_array($result)){ if ($row[0]== $subcat_id)echo '<option selected="yes" value="'.$row[0].'">'.$row[2].' - '.$row[1].'</option>';elseecho'<option value="'.$row[0].'">'.$row[2].' - '.$row[1].'</option>'; } mysql_free_result( $result ); echo"</select>";?> AJAX <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><script type="text/javascript">function show(){var option = document.getElementById('subuniverso').selectedIndex;var ref = document.getElementById('subuniverso').options[option].text.substr(0,3); alert( ref); // <- Retorna os dados em array dos option selecionados $.ajax({ url: 'inser_actividade.php', type: 'POST', data: {ref : ref}, cache: false, success: function(response) { alert('foi enviado com sucesso' + ref) }, } );};show();</script>
  4. Normally when we use post method with forms, the requests are geting cached. I mean when we use the back button to visit the previous page the request is not being sent to the server to display the previous form. It just loads the form from the cache and loads the field values from the cache. But it is not the case with ajax. when we use ajax with post method the requests are not cached. when we use the back button also the ajax gets the content from the server which is contrary to its "get" method. So why this difference?
  5. Hi All, i'm doing sample ajax exercise and getting the response from server but the response work fine in IE browser but not in firefox/chrome browser. below is the code snippet also find the snippet ========================= ajaxdemo.html =========================l <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <input type="text" id="inputDisplay" /> <button type="button" onclick="sendMessageToServer()">Send To Server</button><br/> <input type="text" id="textDisplay"/> <script type="text/javascript"> var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { isIE = true; xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } function sendMessageToServer() { xmlhttp.open("POST","/LabAjax04/AjaxDemoServlet?name="+document.getElementById("inputDisplay").value,true); xmlhttp.onreadystatechange=receiveMessageFromServer; xmlhttp.send(); document.getElementById("inputDisplay").value=''; } function receiveMessageFromServer() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { alert(xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text);// displays undefined alert(xmlhttp.responseText);//display the response from server document.getElementById("textDisplay").value=xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text; } } </script> </body> </html> ======================= java file ====================== package com.sample.ajax; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class AjaxDemoServlet */ public class AjaxDemoServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AjaxDemoServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {} /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("server recived the folwwoing messgae from client:"+request.getParameter("name")); response.setContentType("text/xml"); response.getWriter().println("<responseFromServer>"+request.getParameter("name")+"</responseFromServer>"); System.out.println("server replied with the folwwoing messgae to client:"+request.getParameter("name")); } } ========= web.xml ========= <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>LabAjax04</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <description></description> <display-name>AjaxDemoServlet</display-name> <servlet-name>AjaxDemoServlet</servlet-name> <servlet-class>com.sample.ajax.AjaxDemoServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>AjaxDemoServlet</servlet-name> <url-pattern>/AjaxDemoServlet</url-pattern> </servlet-mapping> </web-app> Thanks in advance!!!
  6. I need to pass multiple data through ajax, and also should post back it in another page. but my code is not working, this is my code: var data = {page_num: page,gender: <?php echo $gender;?>this_year: <?php echo $year;?>};$.ajax({ type: "POST", url: "data.php", data: data, success: function(res) { $("#result").append(res); console.log(res); } }); POST the values(data.php): echo $page = $_POST['page_num'];echo $gender = $_POST['gender'];echo $fromyear = $_POST['this_year']; please guys help me. thnx,
  7. it is main file retrive here data of drop down but not retrive data ? not display country in the select list so plaese help me it is main.php <!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body> <table><tr><td>Country </td><td><select name="country" id="country" onchange="getState(this.value)"><option value="-1">Select Country</option><?php$cntry = mysql_query("SELECT `Country_Id`, `name` FROM country ORDER BY `name` ASC");while($row = mysql_fetch_assoc($cntry)){echo '<option value="'.$row['Country_Id'].'">'.$row['name'].'</option>';}?></select></td></tr><tr><td>State </td><td>: <select name="state" id="state" onchange="getCity(this.value)"><option value="-1">Select State</option></select></td></tr><tr><td>City </td><td>: <select name="city" id="city" ><option value="-1">Select City</option> </select></td></tr></table></body></html>
  8. Ok i'm totaly new here, I play with some code when I have time for it... But I'm a little confused, it seems that the new ajax way is coded as $.ajax but that I don't understand yet, Because i'm adjusting some existing code I have to go from one php file to another over js the old way... So I have a php file where I echo a div with an input as type="text" and id="txtnameposition", in the same div I have a button who is calling the function closeandmail in the JS file. In the JS file I get de input of the textbox as: var jsName = document.getElementById("txtnameposition").value; When I put an alert(jsName); inside the JS file I do get the input value, so passing values from the first php file to the js file is no problem.... BUT, to send this all to the next PHP file I used next code in the JS file: function getHTTPObject(){var xhr = false;//set to false, so if it fails, do nothingif(window.XMLHttpRequest) {//detect to see if browser allows this methodvar xhr = new XMLHttpRequest();//set var the new request} else if(window.ActiveXObject) {//detect to see if browser allows this methodtry {var xhr = new ActiveXObject("Msxml2.XMLHTTP");//try this method first} catch(e) {//if it fails move onto the nexttry {var xhr = new ActiveXObject("Microsoft.XMLHTTP");//try this method next} catch(e) {//if that also fails return false.xhr = false;}}}return xhr;//return the value of xhr}function closeandmail(){var jsName = document.getElementById("txtnameposition").value;httpObjectMail = getHTTPObject();if (httpObjectMail !== null) {httpObjectMail.open("GET", "mail.php?"+ "Name=" + jsName);httpObjectMail.send(null);}httpObjectMail = null;} And in the second PHP file I put next code: $Name = $_GET['Name']; echo 'Name = '.$Name;$MailMessage = 'The name = '.$Name;$to = 'mail@mail.com';$subject = 'The name = '.$Name;$headers = 'From: mail@mail.com'.'rn'.'X-Mailer: PHP/' . phpversion();mail($to, $subject, $MailMessage, $headers); The echo only shows "Name = " and no value, so can someone please tell me what is wrong in this code? because I did try a lot of things but it didn't work so far. Greetings Trace7r.
  9. Hi, I have two pages. The first page has two links, when a user clicks on one of them then s/he can view some information. I have used an image viewer taken from http://projects.sebastianhelzle.net/jquery.rondell/examples/carousel.html and I have set it according to my needs. the code of the first/main page is: <html><head><title>Animals</title><script>function loadXMLDoc(){var xmlhttp;if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { document.getElementById("rondellCarousel").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","second.html",false);xmlhttp.send();}</script></head><body> <a href = "#" onClick = "loadXMLDoc();">Αnimals</a><br /> <br /><a href = '#' >Cars</a><div id = "rondellCarousel" class = "false"><!-- I expect to see the image viewer here :/ --></div></body></html> The code of the second page is: <!DOCTYPE html><html class="no-js"> <head> <link rel="stylesheet" href="scripts/jquery.rondell.css" type="text/css" media="all" title="Screen"> <script src="scripts/modernizr-2.0.6.min.js"></script> <title></title> </head> <body> <br> <div id="rondellCarousel" class="hidden"> <a target="_blank" rel="rondell_1" href="images/band.jpg" title="My favourite band"> <img src="images/band_small.jpg" alt="Band" title="My favourite band"> <h5>Awesome concert</h5> <p>My favourite band.</p></a><a target="_blank" rel="rondell_1" href="images/dog.jpg" title="My dog"><img src="images/dog_small.jpg" alt="Dog" title="My dog"> <h5>My dog</h5> <p>Standing in front of a glass door and wants in.</p></a><a target="_blank" rel="rondell_1" href="images/cat.jpg" title="My cat"><img src="images/cat_small.jpg" alt="Cat" title="My cat"> <h5>My cat</h5> <p>Sleeping...</p></a><a target="_blank" rel="rondell_1" href="images/boar.jpg" title="Boar"><img src="images/boar_small.jpg" alt="Boar" title="Boar"> <h5>Dead boar on the wall</h5> <p>Hanging around.</p></a><a target="_blank" rel="rondell_1" href="images/snow.jpg" title="Snow"><img src="images/snow_small.jpg" alt="Snow" title="Snow"> <h5>Winter wonderland</h5> <p>The german alps.</p></a><a target="_blank" rel="rondell_1" href="images/rabbit.jpg" title="Rabbit"><img src="images/rabbit_small.jpg" alt="Rabbit" title="Rabbit"> <h5>Bunny</h5> <p>In my brothers garden.</p></a><a target="_blank" rel="rondell_1" href="images/trash.jpg" title=""><img src="images/trash_small.jpg" alt="Trash" title="Trash"> <h5>Trash</h5> <p>Somewhere in the USA.</p></a></div> <script src="scripts/jquery-1.9.1.min.js"></script> <script src="scripts/jquery.rondell.js"></script> <script type="text/javascript">(function() { $(function() { var carousel; carousel = $("#rondellCarousel > *").rondell({ preset: "carousel" }); $(".resize-button").click(function(e) { e.preventDefault(); return carousel.fitToContainer(); }); return $.ajax({ url: "http://www.wookmark.com/api/json", dataType: "jsonp", success: function(data, text, xhqr) { var item, rondellContent, _i, _len, _ref; if (text === "success") { rondellContent = ""; _ref = data.slice(0, 25); for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; rondellContent += " <a href="" + item.image + "" title="" + item.title + " @ " + item.url + "" target="_blank" style="display:none"> <img src="" + item.preview + "" title="" + item.title + "" width="" + item.width + "" height="" + item.height + ""/> </a> "; } return $("#rondellCubic").html(rondellContent).children().rondell({ preset: "cubic" }); } } }); });}).call(this);</script> </body></html> The problem is that, even if Ajax works without getting any problem, the pictures are not presented like a "carousel image viewer". If I put directly the second page in the address bar and browse it, I see the images as I wish (like a carousel image viewer with next/prev arrows). Can anyone help with that? Thank you in advance.
  10. Hi, I am using the following code to display products and prices when dropdown selected. What I need to do though is for a certain table to be selected if the visitor to my site clicks on a particular link. For example if the visitor clicks a link for A2 Leaflets on my home page, I need the drop down to display A2 Leaflets products and prices when the new page loads. Can anyone suggest a way this can be done? I am guessing it only requires something simple to be added to the existing ajax code, I just dont know where to begin looking? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script type="text/javascript">function showUser(){var user = document.getElementById("user").value;var type = document.getElementById("type").value;var finish = document.getElementById("finish").value;if (finish=="") { document.getElementById("txtHint").innerHTML=""; return; }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="+user+"&t="+type+"&f="+finish,true);xmlhttp.send();}</script><link rel="stylesheet" type="text/css" href="dropdown_form.css" media="screen" /></head><body><div id="prices_dropdown_form"><form id="dropdown_form"><select id="user"><option value="">Select Leaflet Type</option><option value="1">A2 Leaflets</option><option value="2">A3 Leaflets</option><option value="3">A4 Leaflets</option><option value="4">A5 Leaflets</option><option value="5">A6 Leaflets</option><option value="6">A7 Leaflets</option><option value="7">210x198 Leaflets</option><option value="8">210x396 Leaflets</option><option value="9">55x85 Leaflets</option><option value="10">1/3 A4 Leaflets</option><option value="11">6pp A4 Leaflets</option><option value="12">6pp A5 Leaflets</option></select><select id="type"><option value="">Select Paper Type</option><option value="1">120 Laser</option><option value="2">130 Gloss</option><option value="3">130 Silk</option><option value="4">170 Bond</option><option value="5">170 Gloss</option><option value="6">170 Silk</option><option value="7">250 Gloss</option><option value="8">250 Silk</option><option value="9">300 Bond</option><option value="10">350 Silk</option><option value="11">400 Silk</option><option value="12">400 Silk GLam1</option><option value="13">400 Silk GLam2</option><option value="14">400 Silk MLam2</option></select><select id="finish" onchange="showUser()"><option value="">Select Finish Type</option><option value="1">Flat</option><option value="2">Fold</option><option value="3">Creased & Flat</option><option value="4">Creased & Fold</option></select></form><br /><div id="txtHint"><b>Product Info & Prices</b></div></div></body></html>
  11. I have a url (on a separate server with a different domain name) that gives me various parameters I need. I've managed to get the results, but for some reason it doesn't show any results at all in IE and I'm not sure why. It works in every other browser, but just not IE. I've checked the console and there's no errors at all, I've also used jslint.com to check the js code and that's all fine too. While I'm testing this I've removed everything else in the file so that there's nothing that can conflict with it. This is what I'm using to get the results. I have a separate js file that contains this: /*jshint -W061 */function call(url, parameters, callback) { "use strict"; $.ajax({ type: 'POST', url: url, data: parameters, success: function(data) { callback(data); }, cache: false } );} function loadJackpots() { "use strict"; call("https://www.domain.com/passkey", { JL: 0 }, function(data) { var divIdentifier, obj = eval('(' + data + ')'); $.each(obj.JL, function() { divIdentifier = ""; switch (this.gameID) { case 2: divIdentifier = "#snap"; break; case 5: divIdentifier = "#dominos"; break; case 1000: divIdentifier = "#chess1"; break; case 1001: divIdentifier = "#chess2"; break; case 1002: divIdentifier = "#chess3"; break; } if (this.gameID >= 1000) { switch (this.stakeID) { case 4: divIdentifier += "_50c"; break; case 5: divIdentifier += "_1d"; break; case 7: divIdentifier += "_2d"; break; case 9: divIdentifier += "_2d"; break; } } if (this.gameID === 1000) { switch (this.subID) { case 0: divIdentifier += "_1"; break; case 1: divIdentifier += "_2"; break; case 2: divIdentifier += "_3"; break; } } $(divIdentifier).html("$" + this.jackpot); }); } );} I use this to actually load the values: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script><script type="text/javascript"> $(function() { loadJackpots(); }); </script> And to display the results I'm using this: <div id="chess1"><div id="chess1_50c">$1466.85</div><div id="chess1_1d">$1641.11</div><div id="chess1_2d">$378.04</div></div> <div id="chess3"><div id="chess3_50c">$303.86</div><div id="chess3_1d">$523.02</div><div id="chess3_2d">$1473.72</div></div> </div><div style="float: left; margin: 194px 0 0 185px;"><div id="chess2_1"><div id="chess2_50c_1">$195.26</div><div id="chess2_1d_1">$154.37</div><div id="chess2_2d_1">$193.76</div></div><div id="chess2_2"><div id="chess2_50c_2">$146.84</div><div id="chess2_1d_2">$119.58</div><div id="chess2_2d_2">$145.86</div></div><div id="chess2_3"><div id="chess2_50c_3">$2.96</div><div id="chess2_1d_3">$19.25</div><div id="chess2_2d_3">$121.89</div></div> </div></div><div style="height: 80px;"><div id="snap"><div id="snap_jp">$862.16</div></div> <div id="dominos"><div id="dominos_jp">$2823.18</div></div> I've also tried this but to no avail, it just gave me an error saying obj is undefined: <div id="dominos"><div id="dominos_jp">$2823.18</div><script language="javascript">document.getElementById("dominos_jp").HTML=obj.JL[1].jackpot</script></div> I'd be really grateful for any help with this as I've tried everything to get it sorted, but no matter what I do it just won't work in IE. I read something about Ajax doesn't allow cross domain requests but I don't know how to rectify this - the values come from a url that is on another domain and I can't change that.
  12. Hello all,I have tried so many things to get this to work but to no avail, can someon eplease help me out here with a simple script for n XML steam feed.http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/?gameid=221380&format=xml OK NOW THE ISSUE IS:I have a blank webpage which I have placed the above link into, I simply want the contents of the XML feed from the link to appear in mypage.......How do I make the contents of that url appear on the same page??SO I NEED THE SMALL SCRIPT OR HTML CODE TO DO THISAlso I would like to have the background a certain colour and use a certain font like 12point arial with bold headings and lower case text.Can someone please provide me with the html to allow this XML feed to appear on my webpage with a different colour background, arial 12pt font inbold and lowercase____________________________________________________________________________I RECEIVED A REPLY TO THIS POST AND THEY ADDED THIS:It's a little hard to tell from what you wrote. But, I think what you are looking for is an AJAX script to pull in the XML,then CSS can take care of the formatting.Look up how to process a XMLHttpRequest in javascript (or another scripting language). That will let you put the XML file into an array. Then,you can use (javascript) document.write() to put the pieces on your page.______________________________________________________________________________SO this being said do I need a javascript code in the page to show the XML Feed with formatting, what would this code be, this is the magicalquestion :)Could someone please please help me..........With regardsMathew
  13. Hello gentlemen.As continue to my previous post, I got some important question.Lets imagine that there is a site with around 50 000 users at the same time on it, this users is on different pages of this site (10-20 users on page) and on each page they must exchange small amounts of data with each other in real-time (like chat room for example)How can i do this? there is a way to do this wit AJAX by holding request from user to database on server, until server gives answer... but that way it will mean that 50000 request will be opened all over the site on the same time. Isn't that gonna be insane load on the server, and no hoster will allow this? I mean i can't even understand what does that hanging requests means in terms of load on the server, the data, transfered, going to be extremely small, in what values can even evaluate this load? It will eat up server's RAM, or handling 50000 hanging requests will make effect on processor's performance... it's really unclear for me. I was thinking about APE project http://www.ape-project.org/download/ , but then i need to find hoster that will support APE servers (well or am i misunderstanding something?)...Or there is a way to handle this without any insane loads and without using some side servers e.t.c?
  14. Hi, I need to fill a drop-down box from another drop-down box in an ASP using AJAX, I was following the AJAX Database example, but I don't get the data, so don't know what am I doing wrong, could anyone please help me trying to figure out what's wrong or if you have an example of how to fill a drop-down box once you change the value of another drop-down box? here is my code: AJAX.JS function showSubject(str){var xmlhttp;if (str=="") { document.getElementById("materias").innerHTML=""; return; }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("materias").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","materiaslista.asp?q="+str,true);xmlhttp.send();} MATERIASPAGE.ASP<% response.expires=-1 Set base=Server.CreateObject("ADODB.Connection")base.ConnectionString = "DSN=acc"base.Open strSql="Select * from tblMaterias where Carrera="strSql=strSql & "'" & request.querystring("q") & "'" set rsMat=Server.CreateObject("ADODB.recordset")rsMat.Open strSql,base response.write("<table>") do until rstMat.eof for each x in rstMat.Fieldsresponse.write("<tr><td><b>" & x.name & "</b></td>") response.write("<td>" & x.value & "</td></tr>") next rstMat.movenext loop response.write("</table>") %> STUDENTS.ASP I have: <script type="text/javascript" src="ajax.js"></script> <form method="post" action="save_data.asp?ac=1" name="Form1"><tr><td class="style5"><span lang="es-pa"><strong>Carrera</strong></span>:</td> <td class="style5"> <select name="carrera" onchange="showSubject(this.value)" > <option value="">Seleccione una carrera!</option> <%while not rstCar.eof%><option value="<%=rstCar.Fields("id")%>"><%=rstCar.Fields("carrera")%></option><%rstCar.MoveNextwend%></select></td></tr><tr> <td class="style5"><strong>Materias:</strong></td> <td class="style5"> <div id="materias">TEXTO</div></td></tr></form> Thanks
  15. Hi, I'm trying to build a "hello world" AJAX / PHP application: AJAX code: <html><head> <title></title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ //Requete AJAX var resultat = $.ajax({ url: "serveur.php", async: false }); alert(resultat.responseText); }); </script></head><body></body></html> PHP code: <?phpecho 1;?> I would expect the result of the alert() function to be "1", while it is:<?phpecho 1;?> So as far as I understand, the server-side code is not interpreted, and that's surprising to me since it is interpreted when I run it separately, without calling from AJAX. May I ask for your help? Thanks, Mathieu
  16. I am working on a website for a video game streamer I watch and sometimes he plays with other streamers and viewers want to watch them both or in some cases more than 2, all play at the same time. So there are sites that do "dual streams" that will allow you to show both videos on the same page. My idea was to make something similar but scale-able to however many streams are needed. So far I have js functions with all the HTML needed add the video player but not sure how i would add a new video to the page without having to refresh. I am using the document.getElementByID('streams').innerHTML = mainStream()+newStream(); right now to manually show the primary stream and a image to click on to add another stream. function mainStream() { result = "\t<div id=\"stream1\" class=\"td stream\">\n"+ "\t\t<object type=\"application/x-shockwave-flash\" class=\"stream-object\" data=\"http://www.twitch.tv/widgets/live_embed_player.swf\" width=\"100%\" height=\"100%\" style=\"visibility: visible; \">\n"+ "\t\t<param name=\"allowFullScreen\" value=\"true\">\n"+ "\t\t<param name=\"allowScriptAccess\" value=\"always\">\n"+ "\t\t<param name=\"allowNetworking\" value=\"all\">\n"+ "\t\t<param name=\"wmode\" value=\"transparent\">\n"+ "\t\t<param name=\"flashvars\" value=\"hostname=www.twitch.tv&channel=the_black_russian&auto_play=true&start_volume=100\"></object>\n"+ "\t</div>\n"; return(result); } function newStream(streamNum) { result = "\t<div id=\"stream"+streamNum+"\" class=\"td newStream\" onclick=\"getStream()\">\n"+ "\t\t<img src=\"lib/new_stream.fw.png\" style=\"width:100%; height:100%\" alt=\"new stream\" title=\"Click to open a new stream...\" />\n"+ "\t</div>\n"; return(result); } In hard code it would look like this when printed: <div id="streams"> <div id="stream1" class="td stream" style="width: 301px; height: 169.3125px;"> <object type="application/x-shockwave-flash" class="stream-object" data="http://www.twitch.tv/widgets/live_embed_player.swf" width="100%" height="100%" style="visibility: visible; "> <param name="allowFullScreen" value="true"> <param name="allowScriptAccess" value="always"> <param name="allowNetworking" value="all"> <param name="wmode" value="transparent"> <param name="flashvars" value="hostname=www.twitch.tv&channel=the_black_russian&auto_play=true&start_volume=100"></object> </div> <div id="stream2" class="td newStream" onclick="getStream()" style="width: 301px; height: 169.3125px;"> <img src="lib/new_stream.fw.png" style="width:100%; height:100%" alt="new stream" title="Click to open a new stream..."> </div></div> What I am looking to do is when someone triggers getStream() for it to add another stream and list the newStream() code last. This would make the new stream #2 and push the open a new stream part to stream #3. I also would like to add in functionality to close a specific stream. Any help is much appreciated! If I did not explain enough please let me know I will try my best to fill in any details I may have missed.
  17. Nice be with you everyone! I'm planing to use JQuery $.ajax() method to delete 1 row of my database. While searching I found this on the web... $.ajax({ type: 'get', url: '/examples/delete.php', data: 'ajax=1&delete=' + $(this).attr('id'), success: function() { parent.fadeOut(300,function() { parent.remove(); }); } }); I have questions: 1. What is the difference of post & get in the type: ?2. What is the usage of 'ajax=1&delete=' in the data: ?3. If there is success: how about if not success, I mean error handler? Thank you.
  18. Nice be with you everyone! Problem:Every time I click delete (database) button it always trigger 404: and respond "Could not contact server". Questions:1. What is Error 404?2. And how to fix it to run Ajax successfully? Here's my code: var parent=$(this).closest("tr"); $.ajax({ type:'get', url:'javascripts/delete.php', data:'ajax=1&delete='+$(this).attr('id'), statusCode: { 404: function() { $("#alert").html('Could not contact server.'); }, 500: function() { $("#alert").html('A server-side error has occurred.'); } }, error: function() { $("#alert").html('A problem has occurred.'); }, success:function(){ $("#alert").html('Successful!'); parent.fadeOut(300, function(){ parent.remove(); }); } }); Thank you!
  19. Currently I'm learning Ajax with Java.The innerHTML method works when I'm retrieving simple string data from the servlet, and when I need to update only one HTML element.Since I have the need to update more HTML elements it occurred to me that I can use JSON object with several properties (HTML tag data for each element needed updating).After trying that I've noticed that innerHTML method doesn't work, when I try to process the retrieved data in the Callback function.My question is, why is this happening?Did someone had a similar problem when using JSON with Javascript.Just for the record, when I use innerText method I successfully update the HTML elements with JSON properties data, only they update as text and that's what I don't need. (See the video) Thank You.
  20. Nice be with you everyone! Can you give some tutorials about Validates Form using PHP with Ajax & JQuery? I red that it is the best practice...
  21. Hello. I am experimenting with PHP and MYSQL because I am new at it. I am trying to use AJAX to create a query into a database that I have. It isn't working. I'm sure I've made a mistake but I cant seem to find it. Someone please look over my code and see if there is something I am missing. I know my database is working because I use it to log in. It has to be in my code. The results I get from this is blank. The AJAX does call on the PHP correctly because I do get an echo back, but only because the $results isn't working. query/users.php <?phpinclude('includes/config.inc');$sql = "SELECT * FROM user";$result = mysql_query($sql,$con);if($result){echo "Username <br>";}else{echo "Nothing Found: ". mysql_error();}while($row = mysql_fetch_array($result)){echo $row['username'];echo "<br>";}mysql_close($con);?> /includes/config.ini //Real info has been removed for security <?php$hostname = 'hostname';$dbname = 'databank';$username = 'username';$password = 'password';$con = mysql_connect($hostname, $username, $password) or DIE('Connection failed');mysql_select_db($dbname, $con) or DIE("Database isnt available");?> admin.php <?phpsession_start();include('includes/config.inc');if (!isset($_SESSION['username'])) {header('Location: index.php');}?><script type="text/javascript">function q(url){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("q").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET",url,true);xmlhttp.send();}</script><HTML><head><link rel="stylesheet" type="text/css" href="../css/secure.css"><title>Admin Page</title></head><body><table> <tr> <td class='seven'></td> <td class='fi'>Welcome: <?php echo $_SESSION['username']?> </td> <td class='fi'><a href="logout.php">Logout</a></td> </tr></table>This is the ADMIN page<br><input value="Get Users" type="submit" onclick="q('query/users.php')"><div id="q"></div></body></HTML>
  22. Hey Everyone! i have generated JSON from HTML form data, now i want to send that JSON to a PHP page. I have written this javascript. var jsondata;$.fn.serializeObject = function(){ var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o;};$(function() { $('form').submit(function() { jsondata = $('#result').text(JSON.stringify($('form').serializeObject())); return false;});}) Please help me i am new to this..
  23. Ok, I have an interesting problem. I'm using AJAX to pull information from in an XML file. Every thing works, however, quotes are giving me issues. I have the: <SOURCE>llSay("hello world",0)</SOURCE> as one of my elements in the XML. When I pass this in my javascript to the HTML, the source ends up looking like this: <input value="x" onchange="checkState('d4', this, 'llSay(" hello world",0)' ,'its triggered by the state')"> and I need it to look like this: <input value="x" onchange="checkState('d4', this, 'llSay("hello world&quot,0)' ,'its triggered by the state')> so I tried this: <SOURCE>llSay("hello world",0)</SOURCE> and I end up with: <input value="x" onchange="checkState('d4', this, 'llSay("hello world",0)' ,'its triggered by the state')"> What can I do to the XML file to make it pass " as it. I tried \" but I end up with \" as the results.
  24. Hey, everyone. I'm new to the forums, but not to W3 Schools or programming in general. I've spent the past 3-4 days combing the tutorials for asp, asp.net, ajax, php, html5, cshtml, etc. and learned way more about each than I'm probably ever going to need. At this point, I'm only inches closer to completing my project than when I started looking through these (though I suppose I'm a better web dev for it), and there is only one question in my mind - which language should I actually be looking at to make this work? It seems to me after looking through each one individually that any language detailed on W3 Schools will work for what I need, but some of them may be easier than others. That's not something I can determine myself without knowing each language like the back of my hand, however. I'd like to ask your opinions - especially people who have actually used these tools to do similar things. I'd like to do something similar to Comicpress for Wordpress, but less bulky, and friendlier to mixed media. On one hand, if I utterly fail at this, I could just use Comicpress, but I'd like more control over the system and I'd like to only have the files and the processes and features that are necessary to do what I want to do. I've gotten a lot of recommendations from other artists in the same boat to write my own site if I can, rather than using a Wordpress engine. (I'd also like to just see if I can do it, improve my skills in web dev, etc...which is really what most of us are here for, right?)The layout I'm going for is extremely similar to what I would get out of Wordpress for comics.... The most important things are the back/forward and the comments (per strip) - and of course the ads, which will put food on my table, but I'm not too worried about those - those will come with Comicpress if I have to throw in the towel. The part that I really want to be able to include that Comicpress won't be very good at is the tiny audio bar underneath the comic strip. The only thing I regret about comics in general is that you must rely on lighting, etc. to set mood. I know there are Wordpress widgets for this, but none exactly what I had in mind. What I would really like to do is have music attached to the comic that does the following....1) continues to play over several strips as a "soundtrack" (and loops, and plays automatically). The strips are so short that restarting the music for each one would be less than ideal, and would get annoying pretty quickly. This also means the music should not be a playlist, but a single song.2) changes the song automatically at predefined scene changes, when the user hits the back/forward buttons and changes the comic. The music file for each comic should be stored/associated with it somewhere.3) can be turned off (or there's a different "version" of the site where music is not enabled) because this could be very annoying to some users that prefer to read their comics in peace and quiet. It's a cool feature, but certainly not for everyone. I'll be happy if I can get it working and then make a separate page entirely where that functionality is disabled, but it would be nice if it was an switch/checkbox/button on the page that could be cached to that user. Things I've tried...At first, I thought about using AJAX to reload the strip, ads, and comments, and only load the music when the strip changes. Still unsure whether this is the correct/easiest method.Then I found a web widget that "autoresumes" play when a page reloads, which I would be fine with, but I believe it may be impossible to tell it not to resume, and to stop playing the song it's on and play something different. It seems to behave like a playlist as well, from my understanding.I thought about having a database for the strips, where an image file, page ID, (chapter/volume number, commentary, etc etc), and music file is defined. When the music file defined on the page to be displayed is different than what is playing, the music changes. But it does not, under any circumstance, change to a new song in the middle of a strip, as a playlist would (which is most wordpress and audio widgets in general).Other things I'm unsure of (because I haven't tried it yet) are how to connect the list of comments to each particular strip individually, and how to load new comics, comments, and ads without creating a new page file for each and every one. I want to make it as quick and easy as possible to add new content without having a billion html files like back in the dark ages, but I still want users to be able to link to a specific page. TLDR; Again, I've read MOST of the tutorials and understand most of them, and I still have no idea WHICH route I should be looking into and researching further in order to make something like the above. A simple point in the right direction (so I can continue the Google search and know for certain there's a light at the end somewhere) is all I ask, but if anyone does have specific answers to these questions, I'd be happy to have them. I just don't want to start looking into, say, classic ASP, when I should be using PHP or something, and find out only after weeks of work that I should have gone down a different route.Thank you for your help!!
  25. will71110


    So I have this project I'm suppose to be doing. It's to make a web page using AJAX to update a page every 5 seconds, stop/start when a button is pushed, and dynamically update when the back end XML is updated. The problem I have is that it isn't updating (FTP) right after I change the XML. It takes like 5 to 10 mins for it to actually update. here is the code: <script type="text/javascript">var z = 0;var repeatIDfunction halter(url){ if (repeatID){ clearInterval(repeatID) repeatID = null document.getElementById('ChangeMe').innerHTML = "Message paused"; } else{ loadXMLdoc(url) }}function loadXMLdoc(url) { var xmlhttp var txt if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("microsoft.XMLHTTP"); } repeatID = window.setInterval(function() { xmlhttp.open("GET", url, true); xmlhttp.send(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { x = xmlhttp.responseXML.documentElement .getElementsByTagName('message'); if (z < x.length) { xx = x[z].getElementsByTagName("content") txt = xx[0].firstChild.nodeValue z += 1 if (z == x.length){ z = 0 } } } document.getElementById('ChangeMe').innerHTML = txt; } }, 1000);}</script> Is it in my script or is my browser doing something it's not suppose to??
  • Create New...