Zen Cart Logo
Forums / General Questions / Database query VS Ajax

Database query VS Ajax

Views: 737

Results 1 to 5 of 5
30 Mar 2011, 8:31 PM
#1
tiffbrink avatar

tiffbrink

New Zenner

Join Date:
Feb 2008
Location:
Allen, TX
Posts:
29
Plugin Contributions:
0

Database query VS Ajax

Why does the database query function not work inside the AJAX
'if ($_REQUEST[...]'?

If I do not try to include the query, then AJAX works fine. If I include the query outside of the 'if ($_REQUEST..)' then it queries the database fine. Can someone explain why this is?

30 Mar 2011, 9:24 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Database query VS Ajax

Ajax is not part of the default code and you are asking this in the General questions that deals with default code

You have not stated what it is you are attempting nor what 3rd party addon this might come from

There is a contributed addons area and most addons have a support thread located there

31 Mar 2011, 1:15 PM
#3
tiffbrink avatar

tiffbrink

New Zenner

Join Date:
Feb 2008
Location:
Allen, TX
Posts:
29
Plugin Contributions:
0

Re: Database query VS Ajax

There is no third party. I just wanted to add a little AJAX functionality to dynamically change drop down options when an option in another dropdown is changed. This type of behavior is very simple and I have done it many times outside of Zencart but for some reason Zencart does not seem to be AJAX friendly.

31 Mar 2011, 5:05 PM
#4
tiffbrink avatar

tiffbrink

New Zenner

Join Date:
Feb 2008
Location:
Allen, TX
Posts:
29
Plugin Contributions:
0

Re: Database query VS Ajax

Ok, figured it out. The trick isn't to connect to db outside of the includes...the key is getting js to post directly to the php file when it is in the includes. There is some override for the includes folder that doesnt allow files in includes to be accessed directly unless you work around it. If someone knows off the top of their head where the override is or can explain how it works, please share.

31 Mar 2011, 5:16 PM
#5
tiffbrink avatar

tiffbrink

New Zenner

Join Date:
Feb 2008
Location:
Allen, TX
Posts:
29
Plugin Contributions:
0

Re: Database query VS Ajax

So there is a wiki that explains the override system. Also, sorry for posting this in the wrong place. If I could delete or move it I would :blush: