Jump to content

[SOLVED] using the same object?


acidglitter

Recommended Posts

i'm really new to ajax so i'm not completely sure on the regular way to code things. this is what i have now to start an object:

 

var object = false;
if(window.XMLHttpRequest){
object = new XMLHttpRequest();
} else if(window.ActiveXObject){
object = new ActiveXObject("Microsoft.XMLHTTP");
}

 

 

what i have been doing is using javascript to start a function, then putting that code at the beginning of the function to create the object. for each thing i'm using ajax for i have a new function and a new object created for it. should i just keep doing it that way? or would it be better to start the object at the top of the page, then have each function just use that object over and over again?

Link to comment
https://forums.phpfreaks.com/topic/106367-solved-using-the-same-object/
Share on other sites

I'll say the same thing as I said a little while ago here: http://www.phpfreaks.com/forums/index.php/topic,197874.0.html

 

Um, is there a reason you don't just use one of the many JS libraries already in existence? Why reinvent the wheel? A nice lite-weight one I use a lot is jQuery

i'll try looking at their site, but like that other person said, i like trying to understand it all myself, and besides that, for me, just using someone elses code takes most of the fun out of programming for me. i like experimenting and editing every little detail

well i'm looking at some jquery tutorials and its looking really interesting. i might actually end up using it for a couple of my sites and just edit or add a few things :)

for now i think i'll just keep creating new objects with each function. thanks for the link :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.