EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First New
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom

Knowledge Bank

Discussion Forums
Enigma Chat New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Enigma Zine
Downloads
Tools New

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Hakipedia: An open collaborative for all your information security needs.

The Urinal

Click Here To Vote For EG!

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site.

enigma group

enigma group

enigma group

enigma group

Enigma Group's Code Bank


Simple Ajax Wrapper

By: -epoch-  -  Date Submitted: 2008-10-20 09:56:21

  1. var AjaxObject = function() {
  2. this.xmlHttp = null
  3. this.transport = null
  4. this.method = "post"
  5. this.url = ""
  6. this.div = ""
  7.  
  8. this.create = function(url, transport, method) {
  9. this.xmlHttp = initialize()
  10. this.transport = transport
  11. this.url = url
  12. this.method = method
  13. }
  14.  
  15. this.request = function(params,div) {
  16. this.div = div
  17. var string = this.url + "?" + params
  18. this.xmlHttp.open(this.method,string,true)
  19. this.xmlHttp.onreadystatechange = this.transport
  20. this.xmlHttp.send(null)
  21. }
  22.  
  23. this.getData = function() {
  24. if (this.xmlHttp.readyState == 4) {
  25. return this.xmlHttp.responseText
  26. }
  27. return null
  28. }
  29.  
  30. this.getDiv = function() {
  31. return this.div
  32. }
  33.  
  34. function initialize() {
  35. var xmlHttp=null
  36. try {
  37. xmlHttp=new XMLHttpRequest()
  38. } catch (e) {
  39. try {
  40. xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
  41. } catch (e) {
  42. try {
  43. xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
  44. } catch (e) {
  45. alert("Your browser does not support AJAX, please upgrade!")
  46. return false
  47. }
  48. }
  49. }
  50. return xmlHttp
  51. }
  52. }
  53.  
  54. //this would be used like this...
  55.  
  56. var chat = new AjaxObject()
  57.  
  58. chat.create("ajaxChatActions.jsp",chatCallBack,"post")
  59.  
  60. function chatCallBack() {
  61. var response = chat.getData()
  62. if (response != null) {
  63. var div = chat.getDiv()
  64. }
  65. }
  66.  
  67. //and a request would be sent like this
  68.  
  69. chat.request('action=send&random=' + Math.random(),'yourdiv')
  70.  
  71.  
Return to ajax category list

Who's Online

483 Guests, 101 Users
ckryptix, viper0i0, Diznablo, rabbidmind, asapong, Nasrudin, CollapsingWalls, mehtaparag, bitstrike, jnony, C, Nicid1, Nusquam-Redono-Sapientia, bazcrown, saifulfaizan, The End, Ultraminor, psychomarine, st3alth, themastersinner, pgmrlink, login, lionaneesh, ishkur88, mahraja, Mac, chekifr, gandalf88, Vap0r, t0ast, tantrum6226, BnE, Distorted, Psiber_Syn, Ausome1, invas10n, oldgoat, freedaysbecumei, BinaryShinigami, Rex_Mundi, Red_beard, Strobeflux, s0m3nak3dguy, Descent, teehee, machupicchu, Genetix, Anandarl, NotMyOwn, thegamerdude, Godzila, popo12341234, RedEvolution, velocity_b, myne17, teto111, aVoid, Central-Gsm, 1101, JackalReborn, InjectioN, h4lted, c0re, DisPater, markt4death, splatta, Jackowacko, saint556, Pyron2312, Azerion, howsens, white.hat.gone.bad, vazzilly, pwunkz, Ios, Inverted, QuarterCask, Infernoe11, deskata, cr4ck3rj4ck, Blizer, jasonmax, j0sh, gwenwavor, N4g4c3N, spizeyboy, Network X, Uino59, Jae Cee, ianFDK, saykov, medhaavee, zofy, demonkiller410, Stumble, SaMTHG, kishore, Raze, helasraizam, Venom1019, Jakabo