SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTTP Request (How?)

    Hi,

    I need JS to make HTTP request (GET).

    I need JS to execute .php file with ?a=0&b=1&... GET parameters.

    Code:
    httprequest = new Image(0,0);
    httprequest.src = 'a/a.php?test=1';
    Does not activate a.php

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    Not that, it's not good with IE. IE does not run script using that method without user's permission.

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kaisellgren View Post
    Not that, it's not good with IE. IE does not run script using that method without user's permission.
    Yes, it does. You can only connect to the same host as you serve the HTML document from though.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh god that feels so stupid.

    All I want is to run a .php file whenever a visitor views my html page. And yes, I do not want to add php code into my html page. I need to do this with VB or JS or something similar.

    Whatever I do with the .php page, I get error retrieving XML data. I don't want to retrieve any data, I want to execute a .php file.

    I tried to do this with <img src="a.php?test=1" /> but the .php isn't executed as it didn't create a new file what I told it to create in the code.

    Any other ideas?

  6. #6
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kaisellgren View Post
    I tried to do this with <img src="a.php?test=1" /> but the .php isn't executed as it didn't create a new file what I told it to create in the code.

    Any other ideas?
    What happens if you request a.php?test=1 directly?

  7. #7
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure it didn't run the "a.php" file? How are you verifying that? Keep in mind: that file can only return an image. However, it can set a cookie - which is the typical way of using RS with images.

  8. #8
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've used RSLite before and it always worked well - it uses the same technique - just assign the url of a php file to an image object.

  9. #9
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    >ajax<

    maybe use an invisible iframe and use javascript to control it and make it load that page


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •