tinker Posted April 17, 2008 Share Posted April 17, 2008 i'm very self taught with ajax, i found an example which said this is how complicated it wasn't, the rest was up to your protocol... The problem i get is when upon loading a new page, say a connection sends a msg, then another is sent upon the send returning, however i get errors: Error: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: http://127.0.0.1/ajax/index :: ajax_send :: line 279" data: no] This error is always from the second send... this is some of the connection code (i assume it's tcp, however can it handle sending another msg before the last returns?): function ajax_create_conn() { if(navigator.appName == 'Microsoft Internet Explorer') { try { ajaxconn=new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { ajaxconn=new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { alert('Your browser does not support AJAX!'); ajaxconn = null; } } } else { // Firefox, Opera 8.0+, Safari ajaxconn = new XMLHttpRequest(); } return; } function ajax_send(cmd) { if(ajaxconn != null) { ajaxconn.onreadystatechange = ajax_handle_conn; ajaxconn.open('get', '".$loc."?cmd=' + cmd); ajaxconn.send(null); } } function ajax_handle_conn() { if(ajaxconn.readyState == 4) { var response = ajaxconn.responseText; //... } } Quote Link to comment Share on other sites More sharing options...
tinker Posted April 17, 2008 Author Share Posted April 17, 2008 OK, some searching and I find that firefox trips when trying to make multiple connections... strange because once it's going it handles it fine, anyway i've set a second set of connection handlers which seems far from ideal. However I now expect that I might need to set up a third connection set. I'm going to do some tests to see if I just need a separate handler or send function, any wisdom will be gratefully received... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.