Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    345
    Plugin Contributions
    0

    Default Send Javascript ajax request to php include

    I have a javascript that is on every page. I want to load some variables to an ajax.php script i have.

    If I have ajax.php in the site root and use the following code in my js, everything is fine.
    Code:
    $('#div').load('ajax.php', {'id': obj, 'action': action});
    However, I would like for the ajax.php file to be in my jscript folder.

    So when I try the following, I get a 403 forbidden in my console.

    Code:
    $('#div').load('includes/templates/classic/jscript/ajax.php', {'id': obj, 'action': action});
    Is there something I need to do to make this work?

    Thanks in Advance

    ~D

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Send Javascript ajax request to php include

    Quote Originally Posted by djdavedawson View Post
    I would like for the ajax.php file to be in my jscript folder.
    Why?

    For security reasons, .php files under the /includes/ folder are blocked from having access from browsers.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    345
    Plugin Contributions
    0

    Default Re: Send Javascript ajax request to php include

    Why?
    I was concerned about having ajax.php in the root and at the same time wanted to keep all the files for this project together.

    With ajax.php in the root, it can be accessed directly.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Send Javascript ajax request to php include

    Quote Originally Posted by djdavedawson View Post
    With ajax.php in the root, it can be accessed directly.
    That's the whole idea.
    Ajax connects directly from the browser, just like if you typed it into the URL field and visited it directly like a webpage. Thus it needs to be accessible directly.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    345
    Plugin Contributions
    0

    Default Re: Send Javascript ajax request to php include

    Thanks Dr B

 

 

Similar Threads

  1. v150 Using XHR Request for Ajax based on what product(s) are chosen
    By RobertH in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 3 Feb 2016, 11:27 PM
  2. Can I include external data via ajax in my shopping cart page?
    By tiffbrink in forum General Questions
    Replies: 1
    Last Post: 26 Feb 2013, 08:32 PM
  3. Yellow1912's css javascript loader breaks Ajax EasySlider
    By dutchy in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 27 Oct 2010, 11:23 AM

Posting Permissions

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