•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,478 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,191 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1431 | Replies: 1
![]() |
| |
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation:
Rep Power: 7
Solved Threads: 59
You mean AJAX ?
javascript Syntax (Toggle Plain Text)
////////////////////////////////////////////////////////////////////////// // // Author: Holly Styles // Copyright: Weblogik 2006 // // Description; basic AJAX framework for ASP.NET projects // // Usage: // Implement two functions to handle successfull and failed requests. // In your page create an instance of responseHandler(fnSuccess, fnFail) // passing references to the above functions in the constructor. // call the executeRequester(method, url, cgi, myHandler) function, // // Examples: // function mySuccessHandler(requester){ alert(requester.responseText); } // function myFailedHandler(requester){ alert("Request failed!"); } // // var myHandler = new responseHandler(mySuccessHandler, myFailedHandler) // // executeRequester("GET", "YourPage.aspx", "", myHandler); // executeRequester("GET", "YourPage.aspx", "ID=1&value=value", myHandler); // executeRequester("POST", "YourPage.aspx", "ID=1&value=value", myHandler); // // Compatability: // IE 6, Firefox 1.5, (opera, safari, etc. should work but not tested) // ///////////////////////////////////////////////////////////////////////////// function newRequester() { var requester; try { requester = new XMLHttpRequest(); } catch(error) { try { requester = new ActiveXObject("Microsoft.XMLHTTP"); } catch(error) { alert(error); requester = null; } } return requester; } function executeRequester(method, url, cgi, handler) { var requester = newRequester(); requester.onreadystatechange = function() { if(requester.readyState == 4) { if(requester.status == 200 || requester.status == 304) { handler.success(requester, url); handler = null; } else { handler.fail(requester, url); handler = null; } } return true; }; method = method.toUpperCase(); if(method == "GET" && cgi != "") { url = url + "?" + cgi; } requester.open(method, url, true); requester.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); if(method == "POST") { requester.send(cgi); } else { requester.send(null); } } function responseHandler(fnSuccess, fnFail) { this.success = fnSuccess; this.fail = fnFail; }
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax apple asp backup cocoa crash daniweb database dell developer development drivers firefox framework games graphics home intel internet java linux mail microsoft microsystems mozilla msdn news next office open open source open-source opengl programming qmail red hat server site smtp software source sql step sun super system ubuntu vista web windows
- how to make the aspx page at runtime (ASP.NET)
- Email an aspx page (or any webpage you want) (ASP.NET)
- How to disable Back button of IE when executing welcome.aspx page? (ASP.NET)
- Copying styles from one window to another... (HTML and CSS)
- calling aspx page from asp (ASP)
- aspx page not loading!!!! Method called too soon (C#)
- .aspx page won't open at home (ASP.NET)
- Page_Load never called when I browse to my aspx page (ASP.NET)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: serious problem..in online examination ..plz solve that as soon as possible
- Next Thread: Javascript Function Link



Hybrid Mode