Search Results

Search found 226 results on 10 pages for 'onreadystatechange'.

Page 3/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Javascript ajax asynchronous question...

    - by Polaris878
    Hello, I'm wondering if anyone can help me understand some asynchronous javascript concepts... Say I make an asynch ajax call like so: xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange= myFoo; xmlhttp.open("GET",url,true); Here is my callback function: function myFoo() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { // Success message } else { // some error message } } } Now, where and when does the execution path start again? Once I make the call to open(), does execution continue directly below the open() and another "thread" enters the asynch function once the ajax request has been completed? Or, does the browser wait for the request to complete, make the Asynch call, and then execution continues right after the open? Thanks!

    Read the article

  • How to structure javascript callback so that function scope is maintained properly

    - by Chetan
    I'm using XMLHttpRequest, and I want to access a local variable in the success callback function. Here is the code: function getFileContents(filePath, callbackFn) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { callbackFn(xhr.responseText); } } xhr.open("GET", chrome.extension.getURL(filePath), true); xhr.send(); } And I want to call it like this: var test = "lol"; getFileContents("hello.js", function(data) { alert(test); }); Here, test would be out of the scope of the callback function, since only the enclosing function's variables are accessible inside the callback function. What is the best way to pass test to the callback function so the alert(test); will display test correctly?

    Read the article

  • Why are $_POST variables getting escaped in PHP?

    - by George Edison
    When my PHP script receives data from an AJAX POST request, the $_POST variables are escaped. The really strange thing is that this only happens on my production server (running PHP 5.2.12 on Linux) and not on my local server (running PHP 5.3.1 on Windows). Here is the AJAX code: var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); pageRequest.onreadystatechange = function() { } var q_str = 'data=' + " ' "; pageRequest.open('POST','unnamed_page.php',true); pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); pageRequest.setRequestHeader("Content-length", q_str.length); pageRequest.setRequestHeader("Connection", "close"); pageRequest.send(q_str); Is there any reason this is happening? And how should I fix this so that it works on both servers?

    Read the article

  • PHP is not called properly in IE using set interval function in Javascript

    - by Hemant
    Hi all, I am trying to show the message updated in DB using the following code var showtime = setInterval('redirect()',5000); ////Redirecting to DB Status ///// function redirect() { xmlhttp = GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="isResultexist.php" xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } I am collecting the response from PHP here and using it to update the Messages on UI Problem here is it works fine 1st time when it called after 5sec but there after return the Same result even DB is updated, This works fine with Mozilla and google chrome browser regards hemant

    Read the article

  • ajax parameter to send correctly a variable to a specified url

    - by kawtousse
    I am trying to send data to a servlet from a js file but the servlet never received the parameter. so this is what I have: function showProject(prj) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="ServletxmlGenerator"; idprj = prj.options[prj.selectedIndex].value; //alert(idprj); url=url+"?idprj="+idprj; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } and to capture th request it is with: public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String projectcode=request.getParameter("idprj"); System.out.println("++++projectCode:=" +projectcode); the output is like: ++++projectCode:=null Can any one explain it to me it seems to be correct but i didnot find the error.Thinks

    Read the article

  • Question about AJAX

    - by Doug
    function showHint(str) { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("games").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","hw9.database.php?name="+str,true); xmlhttp.send(); } I'm learning AJAX at the moment. The code here basically receives the echo from the PHP and then puts it in element id games. My question is, if I wanted to have AJAX send 3 different http requests to 3 different PHP scripts and if I wanted to retrieve data from each one and then put it in 3 different element id's then would I make 3 copies of this same function? I would imagine that there should be a more efficient way. Thanks!

    Read the article

  • ajax strange error with sending multiple parameter

    - by kawtousse
    hi everyone, please check with me where is the error in this ajax code to send 2 parameters: var xhr = getXhr(); // On défini ce qu'on va faire quand on aura la réponse xhr.onreadystatechange = function(){ // On ne fait quelque chose que si on a tout reçu et que le serveur est ok if(xhr.readyState == 4 && xhr.status == 200) { selects = xhr.responseText; // On se sert de innerHTML pour rajouter les options a la liste //document.getElementById('prjsel').innerHTML = selects; } }; xhr.open("POST","ServletEdition",true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); id=document.getElementById(idIdden).value; fu=document.getElementById("formUpdate").value; //alert(fu); var i=1; xhr.send("id=" +id+", fu="+i); i cant got the value of fu i don't know why. thanks

    Read the article

  • Why is the value not passed to my controller page in codeigniter?

    - by udaya
    I am selecting state from country and city from state. This is my country select box: <td width=""><select name="country" onChange="getState(this.value)" class="text_box_width_190"> <option value="0">Select Country</option> <? foreach($country as $row) { ?> <option value="<?=$row['dCountry_id']?>"><?=$row['dCountryName']?></option> <? } ?> </select></td> This is my state select box: <select name="state" id="state" class="text_box_width_190" > <option value="0">Select State</option> </select> This is my city select box: <td width=""><div id="citydiv"><select name="city" class="text_box_width_190"> <option>Select City</option> </select></div></td> This is my script: <script type ="text/javascript"> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getState(countryId) { var strURL="http://localhost/ssit/system/application/views/findState.php?country="+countryId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('statediv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getCity(countryId,stateId) { var strURL="http://localhost/ssit/system/application/views/findCity.php?country="+countryId+"&state="+stateId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('citydiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> This is my find state page: <? $country=intval($_GET['country']); $link = mysql_connect('localhost', 'root', ''); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ssit'); $query="Select dStateName,dState_id FROM tbl_state Where dCountry_id='1'"; $result=mysql_query($query); ?> <select name="state" onchange="getCity(<?=$country?>,this.value)"> <option value="0">Select State</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['dState_id']?>><?=$row['dStateName']?></option> <? } ?> </select> This is my find city page: <? $countryId=intval($_GET['country']); $stateId=intval($_GET['state']); $link = mysql_connect('localhost', 'root', ''); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ssit'); $query="Select dCityName,dCity_id FROM tbl_city Where dState_id='30'"; $result=mysql_query($query); ?> <select name="city"> <option>Select City</option> <? while($row=mysql_fetch_array($result)) { ?> <option value><?=$row['dCityName']?></option> <? } ?> </select> When I post a country, I can receive it but I can't receive my state and city. How to receive them?

    Read the article

  • What is the difference between Window.load and document.readyState

    - by prakash
    Hi All, I have one question , In my ASP.NET MVC web application i have to do certain validation once page and all controls got loaded. In javascript i was using belwow line of code for calling a method. window.load = JavascriptFunctionName ; Some one from my team asked me not used above line of code Instead use JQuery to do the same document.attachEvent("onreadystatechange", function() { if (document.readyState === "complete") { CheckThis(); } }); Please help me in understanding what is the difference between two. When i tested by keeping alert in both Jquery check is executing first and calling the CheckThis function where as window.load is taking some time and executing after it. Please suggest

    Read the article

  • AJAX works fine in firefox, but malfunctions in Mozilla Prism 0.9

    - by Babiker
    I have the following ajax fucntion: function ajax(value, url, urlVarname, displayContainers_id){ if(value == ''){ document.getElementById(displayContainers_id).innerHTML=''; } /* THIS IS LINE 12*/ xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ document.getElementById(displayContainers_id).innerHTML=xmlhttp.responseText; } } xmlhttp.open('GET',url + '?varName=' + urlVarname + '&value=' + value, true); /* THIS IS LINE 25 */ xmlhttp.send(); } onmousedown="ajax(document.getElementById('searchParamater').value, 'http://192.168.0.7/controllers/search_controller.php', document.getElementById('searchBy').value, 'ajaxBucket')"> This whole thing works fine in firefox but when i use prism 0.9, it malfunctions and i get the following error in the errors console: Warning: assignment to undeclared variable xmlhttp Source File: http://192.168.0.7/javascript/main.js Line: 12 Error: uncaught exception: [Exception... "Not enough arguments [nsIXMLHttpRequest.send]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://192.168.0.7/javascript/main.js :: ajax :: line 25" data: no]

    Read the article

  • [Simple] Beginner AJAX script not working, stuck on opening XMLHttpRequest

    - by Julian H. Lam
    Hopefully, this question isn't too juvenile to ask - but here goes: I'm trying to learn AJAX, and I'm stuck on a simple content-fetch. Here is my code: request = getHTTPObject(); function useHttpResponse() { if (request.readyState == 4) { document.getElementById("p").innerHTML = request.responseText; } } function update_p() { request.open("GET",content.html,true); request.onreadystatechange = useHttpResponse; } getHTTPObject is correctly defined, and returns a proper XMLHttpObject. As you probably guessed from the excerpt, the element I am trying to update is id'd "p". It calls the script correctly when a button is clicked, no problem there. The script seems to stop at line 8, at request.open. There's no error, and the script silently ignores anything afterward. I don't think I've missed anything, but of course, I probably did. Where did I go wrong? Thanks!

    Read the article

  • Delete old map markers and load new ones?

    - by pufAmuf
    I'm trying to delete the old markers and load new ones. Here is the code I have that loads certain markers on page load - no issues here: (function() { var customIcons = { 1: { icon: 'redmarker.png', shadow: 'markershadow.png' }, 2: { icon: 'purplemarker.png', shadow: 'markershadow.png' }, 3: { icon: 'silvermarker.png', shadow: 'markershadow.png' }, 4: { icon: 'goldmarker.png', shadow: 'markershadow.png' } }; window.onload = function(){ var MY_MAPTYPE_ID = 'custom'; var stylez = [ { "stylers": [ { "hue": "#00ccff" }, { "saturation": -100 }, { "lightness": 5 } ] },{ } ]; var latlng = new google.maps.LatLng(10, 10); var options = { zoom: 16, center: latlng, panControl: false, zoomControl: false, scaleControl: true, mapTypeControlOptions: { mapTypeIds: [MY_MAPTYPE_ID,google.maps.MapTypeId.SATELLITE] }, mapTypeId: MY_MAPTYPE_ID }; var map = new google.maps.Map(document.getElementById('map'), options); var styledMapOptions = { name: 'Map' }; var jayzMapType = new google.maps.StyledMapType(stylez, styledMapOptions); map.mapTypes.set(MY_MAPTYPE_ID, jayzMapType); var infoWindow = new google.maps.InfoWindow; // Change this depending on the name of your PHP file downloadUrl("getxml.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("id"); var address = markers[i].getAttribute("id"); var type = markers[i].getAttribute("venue_type"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = "<b>" + name + "</b> <br/>" + address; var icon = customIcons[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, shadow: icon.shadow }); bindInfoWindow(marker, map, infoWindow, html); } }); //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// //BUTTON SWITCHING //////////////////////////////////////////////////////////// jQuery(document).delegate(".topCanBeActive", "click", function( e ) { e.preventDefault(); jQuery(".topCanBeActive").removeClass("topActive"); jQuery(this).addClass("topActive"); switch( this.id ){ case 'all_activity_button': alert("search"); break; case 'events_button': downloadUrl("getxml2.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("id"); var address = markers[i].getAttribute("id"); var type = markers[i].getAttribute("venue_type"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = "<b>" + name + "</b> <br/>" + address; var icon = customIcons[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, shadow: icon.shadow }); bindInfoWindow(marker, map, infoWindow, html); } }); break; case 'venues_button': alert("venues"); break; case 'search_button': alert("search"); break; } }); //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// //END //////////////////////////////////////////////////////////// } function bindInfoWindow(marker, map, infoWindow, html) { google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(html); infoWindow.open(map, marker); }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} })(); Now, I created a button section where if you press one button, a different xml file is loaded. Notice the section with the ////////////////////// However, upon clicking the button, nothing happens. The xml file itself is okay and loads the desired data. I also receive no errors in firebug. Any ideas why this happens? Thanks!

    Read the article

  • Why can I not send more than one request?

    - by Doug
    function stateChanged(idname) { xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(idname).value = xmlhttp.responseText; } } } function openSend(php,idname) { stateChanged(idname); xmlhttp.open("GET",php,true); xmlhttp.send(); } function showHint() { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } openSend("time.php", "Time"); openSend("date1.php", "Date1"); openSend("date2.php", "Date2"); return; } These two say aborted (in Firebug) and doesn't return a value. Why is that? Is it because I can't send more than 1 request? openSend("time.php", "Time"); openSend("date1.php", "Date1"); If I can't, how could I achieve 3 requests with only one invocation?

    Read the article

  • making ajax request to another server

    - by santhosh
    Hi, I had a ajax sample code from W3Schools, where If i request ajax call to remote server the request getting fails. function loadXMLDoc() { 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("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://www.google.com",true); xmlhttp.send(); } How to solve this..?

    Read the article

  • How can I request a url using AJAX

    - by Nikhil Dinesh
    I am quite new in this area. I need to find out how to make a request to my solr server using Ajax How can I give a url(my solr server's url) in request Any body know how to deal with this? How can i make a request to the below mentioned url http://mysite:8080/solr/select/?q=%2A%3A%2A&version=2.2&start=0&rows=100&indent=on See here: Corrected the Code Snippet as below function getProductIds() { var xmlhttp; if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) console.dir(xmlhttp); else alert('no response'); var ajaxURL = "http://localhost:8080/solr/select/?q=*:*&version=2.2&start=0&rows=100&indent=on"; xmlhttp.open("GET", ajaxURL, true); xmlhttp.send(); } This is my code, it always showing "no response" Thanks.

    Read the article

  • How to get jSon object in servlet from jsp?

    - by divi
    In jsp page i have written: var sel = document.getElementById("Wimax"); var ip = sel.options[sel.selectedIndex].value; var param; var url = 'ConfigurationServlet?ActionID=Configuration_Physical_Get'; httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); httpRequest.open("POST", url, true); httpRequest.onreadystatechange = handler(){ if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { param = 'ip='+ip; param += 'mmv='+mmv; param += "tab="+tab; }}; httpRequest.send(param); i want this param variable in my configurationServlet. Can any one tel me how to get this json object in servlet???

    Read the article

  • ssl security information on internet explorer 6

    - by user309984
    Hi all, I dont want that my webpage show security information about this page contains both secure and nonsecure... this only happen in ie6, i am testing with the program ietester. I know that the problem is in file mootools-1.11-uncompressed.js in this line if(!$("ie_ready")){var C=(window.location.protocol=="https:")?"://0":"javascript:void(0);";document.write('<\/script');$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){A();}};}}else{window.addListener("load",A);document.addListener("DOMContentLoaded",A); i already try change the ://0 by https://0 and javascript: and javascript:false and # but the problem continues, when i remove this line from the mootools file the warning doesnt show but the code that i have to show some calendar doesnt work also, because i have something like /* and this doesnt work if i remove that line, can anyone help me??

    Read the article

  • Variable scope problem in JavaScript

    - by dfjhdfjhdf
    I declare a variable with the var word inside a function that handles Ajax requests, then later on in the function I have another function that should change the value of the variable but - my problem - it fails. How to settle the problem down? Here's similiar code I use: function sendRuest(someargums) { /* some code */ var the_variable; /* some code */ //here's that other function request.onreadystatechange = function() { if (request.readyState == 4) { switch (request.status) { case 200: //here the variable should be changed the_variable = request.responseXML; /* a lot of code */ //somewhere here the function closes } return the_variable; } var data = sendRequest(someargums); //and trying to read the data I get the undefined value

    Read the article

  • Why isn't IE displaying this alert()?

    - by George Edison
    I have the following piece of code: // setup the AJAX request var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); // callback pageRequest.onreadystatechange = function() { alert('pageRequest.readyState: ' + pageRequest.readyState + '\npageRequest.status: ' + pageRequest.status); } pageRequest.open('POST','ajax.php',true); // q_str contains something like 'data=value...' pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); pageRequest.setRequestHeader("Content-length", q_str.length); pageRequest.setRequestHeader("Connection", "close"); pageRequest.send(q_str); This works fine in Chrome, but IE chokes on it, spitting out an "Unspecified error." and it points to the line with the alert() in it. Why can't it display the alert?

    Read the article

  • Permalink Ajax Issue Wordpress

    - by Soumya
    function AjaxRequest(section,divName) { var pageurl = fullPath+"/ajaxrequest.php?section="+section+"&divName="+divName; //alert(pageurl); var xmlhttp; 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(divName).innerHTML=''; document.getElementById(divName).innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",pageurl,true); xmlhttp.send(); } I have a Code like that in wordpress which is calling a page using ajax. It is working fine when the page are coming in ID like ?page_id=37 but stop working when I am activating Permalink like /overview/ajaxpage. I am getting 404 pafe error on xmlhttp.readyState. Can any one help me to solve it. I know its a permalink Problem probably this code of ajax is not sufficient for transmuting Permalink.

    Read the article

  • jquery javascript error using $(...) selector

    - by waitinforatrain
    Hi, I'm migrating some old code to jquery: xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { $("#" + ajaxArea).html (xmlHttp.responseText); $("#" + ajaxArea).attr('title', 'Login'); $("#" + ajaxArea).dialog({ height : 140, modal : true }); } }; where ajaxArea is the ID of a DIV in the HTML. The dialog bit is basically adapted from the jQuery example here: http://jqueryui.com/demos/dialog/#modal All of it works fine up until the last line. Firefox throws an error that simply says "$(" for that line. Anyone know what might be causing this?

    Read the article

  • Ajax, not sending querystring data

    - by Tom Gullen
    var http = false; // Creates xmlhttp object if (navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } http.onreadystatechange = function() { if (http.readyState == 4) { alert(http.responseText); } } // Functions to calculate optimum layout etc. function compute() { var statusSpan = document.getElementById("cwStatus"); document.getElementById("fader").style.display = ""; document.getElementById("computingWait").style.display = ""; statusSpan.innerHTML = "<b>Status:</b> Realigning sattelites" http.open("GET", "alg.aspx?cr=8&cc=7&sq=3,3", true); http.send(null); } This code sort of works, but the querystring data isn't being passed through. It keeps returning an ASPX error page which only happens when there is no querystring data. Thanks for any help

    Read the article

  • code in xmlhttp.readyState==4 doen't get executed

    - by shazia
    function download() { 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() { //alert(xmlhttp.readyState); if(xmlhttp.readyState==4 && xmlhttp.status==200) { alert (xmlhttp.responseText); } } xmlhttp.open("GET","import.php?file="+document.getElementById('uploaded_file').value,false); xmlhttp.send(); // location.reload(true); } if I put alert and monitor xmlhttp.readyState then it shows me that its status does turn 4 and it does go in the if statement, if I don't monitor it with alert then it doesn't go in the if statement but I know import.php is working because I can see the changes in the database. I don't know whats going on...can anyone help. Thanks

    Read the article

  • ajax post sending parameter failed

    - by kawtousse
    hi, in order to send to servlet parameter in post methos i am using ajax like the following: var xhr = getXhr(); xhr.onreadystatechange = function(){ if(xhr.readyState == 4 && xhr.status == 200) {alert("ok"); } }; xhr.open("POST","ServletEdition",true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); id = document.getElementById('idIdden').value; xhr.send("id="+id) In the servet the following: String hd=request.getParameter("id"); System.out.println("idDailyTimeSheet est::" +hd); But it failes every time and the problem that i didn't see the cause. thanks

    Read the article

  • Ajax Double Call

    - by Lordareon
    with this function <script type="text/javascript"> function ajaxcall(div, page) { if (window.XMLHttpRequest) {xmlhttp=new XMLHttpRequest();} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(div).innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",page,true); xmlhttp.send(); } </script> i use my ajax. But in the page i call 2 times this function: <script type="text/javascript">ajaxcall("menu", "perfil.php");</script> <script type="text/javascript">ajaxcall('mapadiv', "map2.php");</script> But happens that only one of them works, if i remove one the other works. What im doing wrong? Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >