Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Dell PowerEdge Servers
  #1  
Old May 1st, 2007, 12:13 PM
jbubrisk jbubrisk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 30 jbubrisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 25 sec
Reputation Power: 2
Question AJAX sepcific question

So I don't really know much about AJAX (I have some books coming in the mail), but as far as I can tell, Javascript would make a call to a PHP page, which would send data back to the Javascript, which would update the existing HTML (using innerHTML or the DOM). In any case, I'm wondering if there is a way to make requests to (PHP) pages outside of a given domain. Here is an example:

I have a plugin for people's websites. What I want to do, is provide them with HTML/Javascript code they can drop on their page. This code will provide a button/link, that when clicked, will "refresh" that portion of the page. However, since I want this "plugin" to be as universal as possible, I don't want to involve any server side scripting languages (like PHP), on the client end. So is it possible for a client's page to use purely Javascript to contact a PHP page (and pass in parameters) on MY site, which would then return some information. That possible?

Just off the top of my head, I remembered that I have used a PHP Image generating file that I can link to. All I do is put the filename in the "src" tag like so:
<img src="my_php_image_generator.php?text=John">
The code above (if it was pointing at my actual page) would display an image in the page, with the text "John". Could I do something like that, but with text instead? Also, could that be AJAX enabled as well? Hope I'm heading in the right direction... Thanks in advance, you guys have been very helpful so far!

Reply With Quote
  #2  
Old May 1st, 2007, 01:39 PM
nawlej nawlej is offline
Moderator
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
Yes, that is something to the effect of what AJAX actually does...when you reference a PHP page outside of domain, I believe you just specify the url address fully. What I would do to update your text on the page, simplistically speaking, is to assign a variable to the text on the page. Then, just have the AJAX call update the variable. Your workflow would look something like this:
(this is untested, but you get the idea)
Code:
var infoHttp = new XMLHttpRequest();
//(or, it would be new ActiveXObject() for non Firefox/etc...

infoHttp.onreadystatechange=function(){
   if(infoHttp.readyState==4){
     //write it to your javascript variable here
   }
}
infoHttp.open("GET","http://path.com/to/script.php",true);
infoHttp.send(null);
__________________
Errors have been made. Others will be blamed.
Group Member, Dallas PHP Users Group &lt;b&gt;(DPUG)&lt;/b&gt;
--... ...--, Eric

Reply With Quote
  #3  
Old May 2nd, 2007, 10:08 AM
jbubrisk jbubrisk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 30 jbubrisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 25 sec
Reputation Power: 2
Lightbulb

Great! Thanks for the info! You know a good site for learning AJAX?

Reply With Quote
  #4  
Old May 2nd, 2007, 09:34 PM
nawlej nawlej is offline
Moderator
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
AJAX is really simple, contrary to popular belief. If you've got some javascript knowhow, and a little xml, you can pick up AJAX in no time. I learned a while ago, but I don't remember where from. There is a tutorial on codewalkers for it though:

http://www.codewalkers.com/c/a/Miscellaneous/Quick-and-Dirty-AJAX-Tutorial/

Reply With Quote
  #5  
Old May 3rd, 2007, 11:19 AM
jbubrisk jbubrisk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 30 jbubrisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 25 sec
Reputation Power: 2
Quote:
Originally Posted by nawlej
AJAX is really simple, contrary to popular belief. If you've got some javascript knowhow, and a little xml, you can pick up AJAX in no time. I learned a while ago, but I don't remember where from. There is a tutorial on codewalkers for it though:

http://www.codewalkers.com/c/a/Miscellaneous/Quick-and-Dirty-AJAX-Tutorial/


Thanks again! Also I just got my book in the mail! I got "AJAX and PHP" by Packt Publishing (Cristian Darie, Bogdan Brinzarea, Filip Chereches-Tosa, Mihai Mucica). I flipped through it a little and it looks pretty good.

Reply With Quote
  #6  
Old May 3rd, 2007, 01:29 PM
roelor roelor is offline
Contributing User
Click here for more information
 
Join Date: Apr 2007
Posts: 81 roelor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 25 m 6 sec
Reputation Power: 2
are there some more (good) tutorials ?
__________________
EAT THIS PIECAKE!!!
liked the old site more

Reply With Quote
  #7  
Old May 3rd, 2007, 03:13 PM
jbubrisk jbubrisk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 30 jbubrisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 25 sec
Reputation Power: 2
In this book? Or are you asking the others? This book seems to have a good deal of sample code, for different applications, but I don't know exactly what the samples do. Liek I said, I just got it :-/

Reply With Quote
  #8  
Old May 3rd, 2007, 07:22 PM
nawlej nawlej is offline
Moderator
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
Tutorials.....Google is your friend :-)

Reply With Quote
  #9  
Old November 4th, 2007, 03:09 PM
icandothat's Avatar
icandothat icandothat is offline
Moderator
Click here for more information.
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 1,526 icandothat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 23 h 14 m 36 sec
Reputation Power: 3
I learned everything I needed to make my first AJAX app from Rasmus's 30 second ajax tutorial. Just google that and you're golden. I have since refined my skills and technique but this will give you all you really really need.
__________________
There is no spoon.

Reply With Quote
  #10  
Old November 6th, 2007, 08:59 AM
jbubrisk jbubrisk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 30 jbubrisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 25 sec
Reputation Power: 2
Wink Thanks!

I'm all set on knowledge now, but I think I'll check it out anyway to compare the techniques to the book I have!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > AJAX sepcific question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway