Search Results

Search found 260 results on 11 pages for 'readystate'.

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

  • After Navigate2 Method returns S_OK Stuck at READYSTATE of READYSTATE_LOADING

    - by Stone Free
    I am working on a MFC Document View architecture application which has multiple documents and views and a tabbed window interface. I have been tasked with making an automatic switch to another tab on the press of the OK button in one of the other tabs. When the other tab is clicked on it uses a C++ wrapper over IWebBrowser2 to navigate to a specific web page. When this is done manually by clicking on the tab everything is fine and the webpage within the view loads successfully. In my first attempt at doing this the tab successfully switched in response to a call to AfxGetMainWnd()->SendMessageToDescendants(SOME_MESSAGE, ...); however by sending this windows message at the wrong point the application would crash once control returned because the chain of events caused the (modeless) dialog (*) that sent the message, to no longer exist. I then found the correct place to make the call, but now when the other tab is activated, it no longer displays the webpage as it should. To debug this problem I added code to check the READYSTATE in both the situation where it works and the situation where it does not. When the page fails to load (despite the call to Navigate2 returning S_OK), the READYSTATE just stays at READYSTATE_LOADING. Unfortunately now I am to many edits away from when I had it partially working. I have added TRACE statements to the most obvious events such as OnSetFocus, CView::OnActivateView but all traces come out in the same order despite the behaviour being different * hosted in the view

    Read the article

  • looking for overview of readystate and browsers

    - by Matt
    I'm finding a lot of problems with trying to determine readyState between IE8, FF3, and Chrome. so far this is what I find: Chrome, FF do not fire an event for .onReadyStateChanged Chrome, FF support .onLoad IE8 supports .onReadyStateChanged, but does not support .onLoad IE8 has also returned loaded, and complete. Mostly it states loaded, but every now and then it spits out complete. Can anyone point me to a chart or overview of browsers and the way they handle readyStates?

    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

  • 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

  • Comet Jetty/Tomcat, having some browser issues with Firefox and Chrome

    - by ages04
    I am exploring the use of Comet for a project I am working on. I tried creating a test application first using Tomcat6 and CometProcessor API and then with Jetty7 Continuations. The application is kind of working on both but I am having some issues with the actual display of messages. I used the technique of creating an XMLHttpRequest Connection and keeping it open all the time so the server can continuously push data to all the clients connected whenever it is available. My client side code is something similar to this: function fn(){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (xhr.readyState==3){ document.getElementById('dv').innerHTML =(xhr.responseText); } if (xhr.readyState==4){ alert ('done'); } } xhr.open("GET", "First", true); xhr.send(null); } I found this thing of using readyState 3 somewhere online. I am facing 2 problems currently: In Firefox this code works perfectly. But if I open a new tab or even a new browser window, it does not make a new connection to the server and nothing shows up on the new tab or window, only the first tab/window gets the display. I used wireshark to check this and its shows only 1 connection even after the 2nd tab is opened. I am unable to understand why this would happen. I have read about the 2 connection limit, but here there is only one connection. Secondly in Chrome, the above code does not work, and the callback is not invoked for readystate of 3, only when the connection is closed by the server i get the output. I would also like to ask which is the best way/framework for doing Comet with Java. I am currently using jQuery on the client side. Any suggestions would be greatly appreciated!! Thanks

    Read the article

  • XHR readyState = 4 but Status = 0 in Google Chrome Browser

    - by Jay
    Hello i'v got a strange Problem with an AJAX call on my site. I make a simple AJAX call to a Script on my site. But the AJAX call fails with readState=4 and Staus = 0. There's no cross domain problem because the script i want to call is on my server. $.ajax({ type:"GET", url: 'http://mydomain.com/test.php', success : function(response){ console.log(response); }, error : function(XHR){ console.log(arguments); } }); I 've googled a lot of sites but there seems to be no solution for that!

    Read the article

  • xmlhttp.responseText and xmlhttp.readyState works fine with localhost but if i use IP address it is

    - by hemant
    Hi All, xmlhttp.responseText and xmlhttp.readyState works fine with localhost but if i use IP address it is not returning values same as localhost. function getFilenames() { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="GetFileNames.php"; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState == 4) { StringFileName = xmlhttp.responseText; } else { StringFileName = null; } } Regards Hemant

    Read the article

  • XMLHttpRequest request is resultin in ReadyState 4 and status is 200.

    - by deepak
    I am trying to make a XMLHttpRequest Request to a content which is on local, runnin on local webserver from a HTML File and javascript residing locally. it will hit the webserver request, and then even thou it sends the data back, in my javscript, at once I get readyState 4 and status as 0. If i try putting the pages in the webserver foloder and access them as webpage slke http;//localhost/ filename then it works fine.

    Read the article

  • detachEvent not working with named inline functions

    - by Polshgiant
    I ran into a problem in IE8 today (Note that I only need to support IE) that I can't seem to explain: detachEvent wouldn't work when using a named anonymous function handler. document.getElementById('iframeid').attachEvent("onreadystatechange", function onIframeReadyStateChange() { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", onIframeReadyStateChange); // code here was running every time my iframe's readyState // changed to "complete" instead of only the first time }); I eventually figured out that changing onIframeReadyStateChange to use arguments.callee (which I normally avoid) instead solved the issue: document.getElementById('iframeid').attachEvent("onreadystatechange", function () { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", arguments.callee); // code here now runs only once no matter how many times the // iframe's readyState changes to "complete" }); What gives?! Shouldn't the first snippet work fine?

    Read the article

  • detachEvent not working with named anonymous functions

    - by Polshgiant
    I ran into a problem in IE8 today (Note that I only need to support IE) that I can't seem to explain: detachEvent wouldn't work when using a named anonymous function handler. document.getElementById('iframeid').attachEvent("onreadystatechange", function onIframeReadyStateChange() { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", onIframeReadyStateChange); // code here was running every time my iframe's readyState // changed to "complete" instead of only the first time }); I eventually figured out that changing onIframeReadyStateChange to use arguments.callee (which I normally avoid) instead solved the issue: document.getElementById('iframeid').attachEvent("onreadystatechange", function () { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", arguments.callee); // code here now runs only once no matter how many times the // iframe's readyState changes to "complete" }); What gives?! Shouldn't the first snippet work fine?

    Read the article

  • What is the best way to inject a javascript script from another domain into a page? (without using a

    - by lowellk
    Here is a snippet of javascript for loading a script onto a given page asynchronously. I was wondering if there was anything wrong with it? Can it be improved? I haven't played with this yet, but some things I'm worried about are: - cross browser support - when script.readyState is true, will the old version of that function get clobbered? - can i always count on there being a head or body element? Here it is: function injectScript(url, callback){ var script = document.createElement('script'); script.type = "text/javascript"; script.setAttribute('async', 'true'); script.src = url; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script); if (callback) { if (script.readyState){ script.onreadystatechange = function(){ if(script.readyState === "loaded" || script.readyState === "complete"){ script.onreadystatechange = null; callback(); } }; }else{ script.onload = function() { callback(); } } } }

    Read the article

  • JQuery > XSLT Plugin > Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transfo

    - by Sean Ochoa
    So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#content").xslt("../xml/plotcards.xml","../xslt/plotcards.xsl", AddPlotcardEventHandlers,reportError); } Here's the modified jquery plugin. I say that its modified because I've added callbacks for success and error handling. /* * jquery.xslt.js * * Copyright (c) 2005-2008 Johann Burkard (<mailto:[email protected]>) * <http://eaio.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * jQuery client-side XSLT plugins. * * @author <a href="mailto:[email protected]">Johann Burkard</a> * @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $ */ (function($) { $.fn.xslt = function() { return this; } var str = /^\s*</; if (document.recalc) { // IE 5+ $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var change = function() { try{ var c = 'complete'; if (xm.readyState == c && xs.readyState == c) { window.setTimeout(function() { target.html(xm.transformNode(xs.XMLDocument)); if (onSuccess) onSuccess(); }, 50); } }catch(exception){ if (onError) onError(exception); } }; var xm = document.createElement('xml'); xm.onreadystatechange = change; xm[str.test(xml) ? "innerHTML" : "src"] = xml; var xs = document.createElement('xml'); xs.onreadystatechange = change; xs[str.test(xslt) ? "innerHTML" : "src"] = xslt; $('body').append(xm).append(xs); return this; }catch(exception){ if (onError) onError(exception); } }; } else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+ var processor = new XSLTProcessor(); var support = false; if ($.isFunction(processor.transformDocument)) { support = window.XMLSerializer != undefined; } else { support = true; } if (support) { $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var transformed = false; var xm = { readyState: 4 }; var xs = { readyState: 4 }; var change = function() { try{ if (xm.readyState == 4 && xs.readyState == 4 && !transformed) { var processor = new XSLTProcessor(); if ($.isFunction(processor.transformDocument)) { // obsolete Mozilla interface resultDoc = document.implementation.createDocument("", "", null); processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null); target.html(new XMLSerializer().serializeToString(resultDoc)); } else { processor.importStylesheet(xs.responseXML); resultDoc = processor.transformToFragment(xm.responseXML, document); target.empty().append(resultDoc); } transformed = true; if (onSuccess) onSuccess(); } }catch(exception){ if (onError) onError(exception); } }; if (str.test(xml)) { xm.responseXML = new DOMParser().parseFromString(xml, "text/xml"); } else { xm = $.ajax({ dataType: "xml", url: xml}); xm.onreadystatechange = change; } if (str.test(xslt)) { xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml"); change(); } else { xs = $.ajax({ dataType: "xml", url: xslt}); xs.onreadystatechange = change; } }catch(exception){ if (onError) onError(exception); }finally{ return this; } }; } } })(jQuery); And, here's my error msg: Object Exception: [unknown name] - Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument] Here's the info on the browser that I'm using for testing (with firebug v1.5.4 add-on installed): Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 I'm really not sure what to do about this.... any thoughts?

    Read the article

  • Trying to call JS Code that is passed back from AJAX call....

    - by Dutchie432
    Okay, so I have an javascript function that retrieves some HTML... function updateQuestions(i){ var url = 'getQuestions.php?sys=' + i; if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", url, true); receiveReq.onreadystatechange = handleQuestionsUpdate; receiveReq.send(null); } } function handleQuestionsUpdate() { if (receiveReq.readyState == 4) { var a=receiveReq.responseText; document.getElementById('questions').innerHTML=a; checkSpeakers(); //Error Occurs Here, even though checkSpeakers() is a function in the returned HTML chunk. } } This HTML is not just HTML, but it is more specifically a form and a chunk of javascript. The javascript is hard-coded into the HTML and not referenced by <script src=".."> Is it normal that this retrieved JS code isn't recognized upon call-time? If so, what is my alternative if I need the JS to change every time the div is update? Now

    Read the article

  • Javascript/ajax/php question: sending from server to client works, sending from client to server fai

    - by Jeroen Willemsen
    Hey All, Sorry for reposting(Admins, please delete the other one!). since you guys have been a great help, I was kinda hoping that you could help me once again while having the following question: I am currently trying to work with AJAX by allowing a managerclass in PHP to communicate via an XmlHttpobject with the javascript on the clientside. However, I can send something to the client via JSON, but I cannot read it at the clientside. In fact I am getting the error that the "time" is an undefined index in Session. So I was wondering: what am I doing wrong? The javascriptcode for Ajax: <script type="text/javascript"> var sendReq = GetXmlHttpObject(); var receiveReq = GetXmlHttpObject(); var JSONIn = 0; var JSONOut= 0; //var mTimer; //function to retreive xmlHTTp object for AJAX calls (correct) function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //Gets the new info from the server function getUpdate() { if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", "index.php?json="+JSONIn+"&sid=$this->session", true); receiveReq.onreadystatechange = updateState; receiveReq.send(null); } } //send a message to the server. function sendUpdate(JSONstringsend) { JSONOut=JSONstringsend; if (sendReq.readyState == 4 || sendReq.readyState == 0) { sendReq.open("POST", "index.php?json="+JSONstringsend+"&sid=$this->session", true); sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); alert(JSONstringsend); sendReq.onreadystatechange = updateCycle; sendReq.send(JSONstringsend); } } //When data has been send, update the page. function updateCycle() { getUpdate(); } function updateState() { if (receiveReq.readyState == 4) { // JSONANSWER gets here (correct): var JSONtext = sendReq.responseText; // convert received string to JavaScript object (correct) alert(JSONtext); var JSONobject = JSON.parse(JSONtext); // updates date from the JSONanswer (correct): document.getElementById("dateview").innerHTML= JSONobject.date; } //mTimer = setTimeout('getUpdate();',2000); //Refresh our chat in 2 seconds } </script> The function that actually uses the ajax code: //datepickerdata $(document).ready(function(){ $("#datepicker").datepicker({ onSelect: function(dateText){ var JSONObject = {"date": dateText}; var JSONstring = JSON.stringify(JSONObject); sendUpdate(JSONstring); }, dateFormat: 'dd-mm-yy' }); }); </script> And the PHP code: private function handleReceivedJSon($json){ $this->jsonLocal=array(); $json=$_POST["json"]; $this->jsonDecoded= json_decode($json, true); if(isset($this->jsonDecoded["date"])){ $_SESSION["date"]=$this->jsonDecoded["date"]; $this->useddate=$this->jsonDecoded; } if(isset($this->jsonDecoded["logout"])){ session_destroy(); exit("logout"); } header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-Type: text/xml; charset=utf-8"); exit($json); }

    Read the article

  • Why is this XMLHttpRequest sample from Mozilla is not working in Firefox 3?

    - by j0rd4n
    I'm trying to get the sample code from Mozilla that consumes a REST web service to work under Firefox 3.0.10. The following code does NOT work in Firefox but does in IE 8! Why is this not working? Does IE 8 have support for XMLHttpRequest? Most examples I've seen use the ActiveX allocation. What should I be doing? XMLHttpRequest seems more standardized. Sample: var req = new XMLHttpRequest(); req.open('GET', 'http://localhost/myRESTfulService/resource', false); // throws 'undefined' exception req.send(null); if(req.status == 0) dump(req.responseText); The open statement is throwing an exception with the description 'undefined'. This is strange as I allocate the req object, am running it in Firefox, and checked to make sure it is defined before calling open (which it says it is of type 'object'). I've also tried the asynchronous version of this with no luck. EDIT 2: Below is my most recent code: function createRequestObject() { if( window.XMLHttpRequest ) { return new XMLHttpRequest(); } else if( window.ActiveXObject ) { return new ActiveXObject( "Microsoft.XMLHTTP" ); } return null; } function handleResponse( req ) { document.writeln( "Handling response..." ); // NEVER GETS CALLED if( req.readyState == 0 ) { document.writeln( "UNITIALIZED" ); } else if( req.readyState == 1 ) { document.writeln( "LOADING" ); } else if( req.readyState == 2 ) { document.writeln( "LOADED" ); } else if( req.readyState == 3 ) { document.writeln( "INTERACTIVE" ); } else if( req.readyState == 4 ) { document.writeln( "COMPLETE" ); if( req.status == 200 ) { document.writeln( "SUCCESS" ); } } } document.writeln( "" ); var req = createRequestObject(); try { document.writeln( "Opening service..." ); req.onreadystatechange = function() { handleResponse( req ); }; req.open('POST', 'http://localhost/test/test2.txt', true); // WORKS IN IE8 & NOT FIREFOX document.writeln( "Sending service request..." ); req.send(''); document.writeln( "Done" ); } catch( err ) { document.writeln( "ERROR: " + err.description ); } EDIT 3: Alright, I reworked this in jQuery. jQuery works great in IE but it throws 'Undefined' when running from Firefox. I double checked and 'Enable JavaScript' is turned on in Firefox - seems to work fine in all other web pages. Below is the jQuery code: function handleResponse( resp ) { alert( "Name: " + resp.Name ); alert( "URL: " + resp.URL ); } $(document).ready( function() { $("a").click( function(event) { try { $.get( "http://localhost/services/ezekielservices/configservice/ezekielservices.svc/test", "{}", function(data) { handleResponse( data ); }, "json" ); } catch( err ) { alert("'$.get' threw an exception: " + err.description); } event.preventDefault(); }); } ); // End 'ready' check Summary of Solution: Alright, web lesson 101. My problem was indeed cross-domain. I was viewing my site unpublished (just on the file system) which was hitting a published service. When I published my site under the same domain it worked. Which also brings up an important distinction between IE and Firefox. When IE experiences this scenario, it prompts the user whether or not they accept the cross-domain call. Firefox throws an exception. While I'm fine with an exception, a more descriptive one would have been helpful. Thanks for all those who helped me.

    Read the article

  • How can I dispatch Firefox or Google Chrome with Python?

    - by Shady
    How can I do this with Firefox or Google Chrome? ie = win32com.client.Dispatch('InternetExplorer.Application') ie.visible = 1 ie.navigate('http://google.com') Is there a way to do it? ps: I need to use the ReadyState with it... for example while (ie.ReadyState != 4):, or in other words, I need some command that wait until the page loads completely until do the next command, that's why I need the dispatch, that currently work very good with IE

    Read the article

  • How do I pass a variable number of parameters along with a callback function?

    - by Bungle
    I'm using a function to lazy-load the Sizzle selector engine (used by jQuery): var sizzle_loaded; // load the Sizzle script function load_sizzle(module_name) { var script; // load Sizzle script and set up 'onload' and 'onreadystatechange' event // handlers to ensure that external script is loaded before dependent // code is executed script = document.createElement('script'); script.src = 'sizzle.min.js'; script.onload = function() { sizzle_loaded = true; gather_content(module_name); }; script.onreadystatechange = function() { if ((script.readyState === 'loaded' || script.readyState === 'complete') && !sizzle_loaded) { sizzle_loaded = true; gather_content(module_name); } }; // append script to the document document.getElementsByTagName('head')[0].appendChild(script); } I set the onload and onreadystatechange event handlers, as well as the sizzle_loaded flag to call another function (gather_content()) as soon as Sizzle has loaded. All of this is needed to do this in a cross-browser way. Until now, my project only had to lazy-load Sizzle at one point in the script, so I was able to just hard-code the gather_content() function call into the load_sizzle() function. However, I now need to lazy-load Sizzle at two different points in the script, and call a different function either time once it's loaded. My first instinct was to modify the function to accept a callback function: var sizzle_loaded; // load the Sizzle script function load_sizzle(module_name, callback) { var script; // load Sizzle script and set up 'onload' and 'onreadystatechange' event // handlers to ensure that external script is loaded before dependent // code is executed script = document.createElement('script'); script.src = 'sizzle.min.js'; script.onload = function() { sizzle_loaded = true; callback(module_name); }; script.onreadystatechange = function() { if ((script.readyState === 'loaded' || script.readyState === 'complete') && !sizzle_loaded) { sizzle_loaded = true; callback(module_name); } }; // append script to the document document.getElementsByTagName('head')[0].appendChild(script); } Then, I could just call it like this: load_sizzle(module_name, gather_content); However, the other callback function that I need to use takes more parameters than gather_content() does. How can I modify my function so that I can specify a variable number of parameters, to be passed with the callback function? Or, am I going about this the wrong way? Ultimately, I just want to load Sizzle, then call any function that I need to (with any arguments that it needs) once it's done loading. Thanks for any help!

    Read the article

  • AJAX XMLHttpRequest Error Flag

    - by blackberryfan234
    Hi, I made a query to an address and I got the readyState = 4, and the status = 0. After I read the documentation for the XMLHttpRequest, it says if the status = 0 and readyState = 4, then check the associated error flag. How can I see whats in this error flag to determine the cause of the status not being set to 200? Thanks.

    Read the article

  • How to upload images from iPhone app developed using Titanium

    - by Karthik.K
    Hi, I finally landed up in developing an iPhone app using Titanium Mobile. Now the problem I face is, Im able to run the app, and the app also sends the image to the server. But Im not able to see the file that got uploaded to the server. I have pasted the iPhone app's code to send image to the server and also, the PHP file that would receive the file from the app. var win = Titanium.UI.currentWindow; var ind=Titanium.UI.createProgressBar({ width:200, height:50, min:0, max:1, value:0, style:Titanium.UI.iPhone.ProgressBarStyle.PLAIN, top:10, message:'Uploading Image', font:{fontSize:12, fontWeight:'bold'}, color:'#888' }); win.add(ind); ind.show(); Titanium.Media.openPhotoGallery({ success:function(event) { Ti.API.info("success! event: " + JSON.stringify(event)); var image = event.media; var xhr = Titanium.Network.createHTTPClient(); xhr.onerror = function(e) { Ti.API.info('IN ERROR ' + e.error); }; xhr.onload = function() { Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState); }; xhr.onsendstream = function(e) { ind.value = e.progress ; Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress+' '+this.status+' '+this.readyState); }; // open the client xhr.open('POST','http://www.myserver.com/tmp/upload2.php'); xhr.setRequestHeader("Connection", "close"); // send the data xhr.send({media:image}); }, cancel:function() { }, error:function(error) { }, allowImageEditing:true }); And here is the PHP code on the server: http://www.pastie.org/891050 I'm not sure where I'm going wrong. Please help me out in this issue. Would love to provide if you need some more information.

    Read the article

  • Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument]

    - by Sean Ochoa
    So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#content").xslt("../xml/plotcards.xml","../xslt/plotcards.xsl", AddPlotcardEventHandlers,reportError); } Here's the modified jquery plugin. I say that its modified because I've added callbacks for success and error handling. /* * jquery.xslt.js * * Copyright (c) 2005-2008 Johann Burkard (<mailto:[email protected]>) * <http://eaio.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * jQuery client-side XSLT plugins. * * @author <a href="mailto:[email protected]">Johann Burkard</a> * @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $ */ (function($) { $.fn.xslt = function() { return this; } var str = /^\s*</; if (document.recalc) { // IE 5+ $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var change = function() { try{ var c = 'complete'; if (xm.readyState == c && xs.readyState == c) { window.setTimeout(function() { target.html(xm.transformNode(xs.XMLDocument)); if (onSuccess) onSuccess(); }, 50); } }catch(exception){ if (onError) onError(exception); } }; var xm = document.createElement('xml'); xm.onreadystatechange = change; xm[str.test(xml) ? "innerHTML" : "src"] = xml; var xs = document.createElement('xml'); xs.onreadystatechange = change; xs[str.test(xslt) ? "innerHTML" : "src"] = xslt; $('body').append(xm).append(xs); return this; }catch(exception){ if (onError) onError(exception); } }; } else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+ var processor = new XSLTProcessor(); var support = false; if ($.isFunction(processor.transformDocument)) { support = window.XMLSerializer != undefined; } else { support = true; } if (support) { $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var transformed = false; var xm = { readyState: 4 }; var xs = { readyState: 4 }; var change = function() { try{ if (xm.readyState == 4 && xs.readyState == 4 && !transformed) { var processor = new XSLTProcessor(); if ($.isFunction(processor.transformDocument)) { // obsolete Mozilla interface resultDoc = document.implementation.createDocument("", "", null); processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null); target.html(new XMLSerializer().serializeToString(resultDoc)); } else { processor.importStylesheet(xs.responseXML); resultDoc = processor.transformToFragment(xm.responseXML, document); target.empty().append(resultDoc); } transformed = true; if (onSuccess) onSuccess(); } }catch(exception){ if (onError) onError(exception); } }; if (str.test(xml)) { xm.responseXML = new DOMParser().parseFromString(xml, "text/xml"); } else { xm = $.ajax({ dataType: "xml", url: xml}); xm.onreadystatechange = change; } if (str.test(xslt)) { xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml"); change(); } else { xs = $.ajax({ dataType: "xml", url: xslt}); xs.onreadystatechange = change; } }catch(exception){ if (onError) onError(exception); }finally{ return this; } }; } } })(jQuery); And, here's my error msg: Object Exception: [unknown name] - Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument] Here's the info on the browser that I'm using for testing (with firebug v1.5.4 add-on installed): Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Here's my XML: <?xml version="1.0" encoding="ISO-8859-1"?> <plotcardCollection sortby="order"> <plotcard order="2" id="1378"> <name><![CDATA[[placeholder for name of plotcard 1378]]]></name> <content><![CDATA[[placeholder for content of plotcard 1378]]]></content> <tagCollection> <tag id="3"><![CDATA[[placeholder for tag with id=3]]]></tag> <tag id="7"><![CDATA[[placeholder for tag with id=7]]]></tag> </tagCollection> </plotcard> <plotcard order="1" id="2156"> <name><![CDATA[[placeholder for name of plotcard 2156]]]></name> <content><![CDATA[[placeholder for content of plotcard 2156]]]></content> <tagCollection> <tag id="2"><![CDATA[[placeholder for tag with id=2]]]></tag> <tag id="9"><![CDATA[[placeholder for tag with id=9]]]></tag> </tagCollection> </plotcard> </plotcardCollection> Here's my XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/plotcardCollection"> <xsl:variable name="sortby" select="@sortby" /> <xsl:for-each select="plotcard"> <xsl:sort select="$sortby" data-type="number" order="ascending"/> <div> <!-- Start Plotcard --> <xsl:attribute name="class">Plotcard</xsl:attribute> <xsl:for-each select="@"> <xsl:value-of select="name()"/> <xsl:text>='</xsl:text> <xsl:if test="name() = 'id'"> <xsl:text>Plotcard-</xsl:text> </xsl:if> <xsl:value-of select="." /> <xsl:text>'</xsl:text> </xsl:for-each> <!-- Start Plotcard Name Section --> <div> <xsl:attribute name="class"> <xsl:text disable-output-escaping="yes">PlotcardName</xsl:text> </xsl:attribute> <xsl:value-of select="name/text()"/> </div> <!-- Start Plotcard Content Section --> <div> <xsl:attribute name="class"> <xsl:text disable-output-escaping="yes">PlotcardContent</xsl:text> </xsl:attribute> <xsl:value-of select="content/text()"/> </div> </div> </xsl:for-each> </xsl:template> </xsl:stylesheet> I'm really not sure what to do about this.... any thoughts?

    Read the article

  • Call Webservice using Javascript

    - by ajithperuva
    I am trying to call a webservice using javascript.But it shows an error like selectSingleNode() is not a method.I am trying it in mozilla firefox.Which is perfectly working in explorer when i change XMLHttpRequest to ActiveXObject.here i am adding my source code which i am tried in firefox. // Web Service functionality // Global vars var xmlDoc = null; var _serviceCallback = null; // Calls web service, web service url and parms, and callback function or null must be provided. // Callback function receives a true or false based on success of call to host function callWebService(url, callback) { _serviceCallback = callback; if(xmlDoc == null) { // xmlDoc = new XMLHttpRequest(); xmlDoc = new XMLHttpRequest(); } xmlDoc.onreadystatechange = stateChange; //callback for readystate xmlDoc.async = true; //do background processing //xmlDoc.load(url); xmlDoc.open('GET', url); xmlDoc.send(); //var doc= xmlDoc.responseXML; } // Updates readystate by callback function stateChange() { if (xmlDoc.readyState == 4) { var err = xmlDoc.parseError; var result = false; var nd; if(err.errorCode == 0) { nd = xmlDoc.selectSingleNode("//envelope/date_time"); if(nd.text != "") result = true; } // perform callback if provided if(_serviceCallback != null) _serviceCallback(result, nd == null ? "" : nd.text); } } // Callback supplied to XMLHttpRequest call function callbackTest(result, data) { obj = document.getElementById("txtOuput"); if(result) obj.value = "Success " + data; else obj.value = "Web Service Call Failed"; } Please help me...Already which kill my 8 more hours...

    Read the article

  • Monitor web sites visited using Internet Explorer, Opera, Chrome, Firefox and Safari in Python

    - by Zachary Brown
    I am working on a project for work and have seemed to run into a small problem. The project is a similar program to Web Nanny, but branded to my client's company. It will have features such as website blocking by URL, keyword and web activity logs. I would also need it to be able to "pause" downloads until an acceptable username and password is entered. I found a script to monitor the URL visited in Internet Explorer (shown below), but it seems to slow the browser down considerably. I have not found any support or ideas onhow to implement this in other browsers. So, my questions are: 1). How to I monitor other browser activity / visited URLs? 2). How do I prevent downloading unless an acceptable username and password is entered? from win32com.client import Dispatch,WithEvents import time,threading,pythoncom,sys stopEvent=threading.Event() class EventSink(object): def OnNavigateComplete2(self,*args): print "complete",args stopEvent.set() def waitUntilReady(ie): if ie.ReadyState!=4: while 1: print "waiting" pythoncom.PumpWaitingMessages() stopEvent.wait(.2) if stopEvent.isSet() or ie.ReadyState==4: stopEvent.clear() break; time.clock() ie=Dispatch('InternetExplorer.Application',EventSink) ev=WithEvents(ie,EventSink) ie.Visible=1 ie.Navigate("http://www.google.com") waitUntilReady(ie) print "location",ie.LocationName ie.Navigate("http://www.aol.com") waitUntilReady(ie) print "location",ie.LocationName print ie.LocationName,time.clock() print ie.ReadyState

    Read the article

  • Can you Download the cmid.ctt File

    - by ArtistDigital
    Can you Download the cmid.ctt File Zong.com.pk http://203.82.55.30/websms/default.aspx?txt_Msg=your-name&txt_MNumber=033489667417&txt_Nick=your-name Still Waiting for Reply.... kindly more Developer to broke the Server expection function alphanumeric(alphane) { var numaric = alphane; for(var j=0; j 47 && hh<59) || (hh 64 && hh<91) || (hh 96 && hh<123)) { } else { return false; } } return true; } function charscount(msg, frm) { frm.num_chars.value = 147 - msg.length; // m = msg; } function moveDivDown() { var el = document.getElementById("chatwindow") st = el.scrollTop; el.scrollTop = el.scrollTop + 300 } function trim(str) { return str.replace(/^\s*|\s*$/g,""); } var XMLHttp; var XMLHttp2; /SEND TO SERVER/ function GetXmlHttpObject() { var objXMLHttp=null /* if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") }*/ var ua = navigator.userAgent.toLowerCase(); if (!window.ActiveXObject) objXMLHttp = new XMLHttpRequest(); else if (ua.indexOf('msie 5') == -1) objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); else objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); return objXMLHttp } function updateChatWindow() { var txt_Msg, txt_mNumber, txt_Nick, myMessage txt_MNumber = document.getElementById("txt_MNumber").value txt_Msg = document.getElementById("txt_Msg").value txt_Nick = document.getElementById("txt_Nick").value txt_Nick = trim (txt_Nick) if (txt_Nick.length==0) { alert ("Please enter the Nick Name") document.getElementById("txt_Nick").focus() document.getElementById("txt_Nick").value="" return false; } if (!alphanumeric(txt_Nick)) { alert ("Please enter a valid alphanumeric Nick Name") document.getElementById("txt_Nick").value="" document.getElementById("txt_Nick").focus() return false; } if (txt_Msg.length==0) return false; if (txt_MNumber.length != 10) { alert ("Please Enter a 10 digit recipient mobile number") return false } if (!IsNumeric (txt_MNumber)) { alert ("Please Enter a valid 10 digit recipient mobile number") return false } document.getElementById("txt_Msg").value = "" document.getElementById("num_chars").value = "147" document.getElementById("txt_Msg").focus() myMessage = '' +txt_Nick + ' Says: ' + txt_Msg + '' document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML + myMessage moveDivDown() XMLHttp = GetXmlHttpObject() if (XMLHttp==null) { alert ("Browser does not support HTTP Request") return false; } var url="default.aspx?" url=url+"txt_Msg="+txt_Msg url=url+"&txt_MNumber="+txt_MNumber url=url+"&txt_Nick="+txt_Nick url=url+"&sid="+Math.random() XMLHttp.onreadystatechange=stateChanged XMLHttp.open("GET",url,true) XMLHttp.send(null) return false; } function stateChanged() { if (XMLHttp.readyState==4 || XMLHttp.readyState=="complete") { try { document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML+ XMLHttp.responseText moveDivDown() } catch (e){} } } /RECEIVE FROM SERVER/ function checkResponse() { XMLHttp2 = GetXmlHttpObject() if (XMLHttp2==null) { alert ("Browser does not support HTTP Request") return } var url="" url=url+"?r=C" url=url+"&sid="+Math.random() XMLHttp2.onreadystatechange=stateChanged2 XMLHttp2.open("GET",url,true) XMLHttp2.send(null) } function stateChanged2() { if (XMLHttp2.readyState==4 || XMLHttp2.readyState=="complete") { try { document.getElementById("chatwindow").innerHTML= document.getElementById("chatwindow").innerHTML + XMLHttp2.responseText moveDivDown() } catch (e){} //Again Check Updates after 3 Seconds setTimeout("checkResponse()", 2000); } } function IsNumeric(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; }

    Read the article

  • Adding a loading gif to simple script

    - by bluedaniel
    Hello everyone, Im really really new to Javascript but Ive got this script that loads the contents of a url and everything works fine. I call the plannerSpin function with an onClick method on a button but how would I go about displaying an animated gif whilst all this is going on? var xmlHttp function plannerSpin(str) { xmlHttp = GetXmlHttpObject() if (xmlHttp == null) { alert("Browser does not support HTTP Request") return } var url = "/recipes/planner/data" xmlHttp.onreadystatechange = stateChanged xmlHttp.open("GET", url, true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { document.getElementById("recipe_planner_container").innerHTML = xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }

    Read the article

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