Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2012
    Posts
    59
    Plugin Contributions
    0

    Default using jquery ajax POST method returning 500 error

    hi i am trying to use this code but keep receiving a 500 internal server error when this runs. is this an issue in my script or do i need to use it differently for zen cart?

    HTML Code:
    jQuery.ajax({
       type: "POST",
       url: "/includes/templates/theme376/phpScripts/check.php",
       data: 'partNum='+ partNum,
       cache: false,
       success: function(response){
    if(response == 1){
    	$('#partNum').css('border', '3px #C33 solid');	
    	$('#tick').hide();
    	$('#cross').fadeIn();
    	}else{
    	$('#partNum').css('border', '3px #090 solid');
    	$('#cross').hide();
    	$('#tick').fadeIn();
    	     }
    
    }
    });

  2. #2
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: using jquery ajax POST method returning 500 error

    Zen Cart is set up to prohibit access to any ".php" files located anywhere inside/under the /includes/ folder.
    You will need to put your script someplace else. It cannot sit in /includes/templates/ nor anywhere else under /includes/
    .

    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
    Jan 2012
    Posts
    59
    Plugin Contributions
    0

    Default Re: using jquery ajax POST method returning 500 error

    Quote Originally Posted by DrByte View Post
    Zen Cart is set up to prohibit access to any ".php" files located anywhere inside/under the /includes/ folder.
    You will need to put your script someplace else. It cannot sit in /includes/templates/ nor anywhere else under /includes/
    I also tried putting it in the root directory and it still returned the error. I tried including a php file that connects to the db without using the global $db object but when I run a query for example

    PHP Code:
    $query "SELECT products_model FROM products WHERE products_model = '$partNum' LIMIT 1";

    $result mysql_query($query);
    $row mysql_fetch_assoc($result);
    print_r($row); 
    I do not recieve a 500 error but the query returns no results. so with this said how can I make an ajax call to a php file that runs a query in zen cart ?

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: using jquery ajax POST method returning 500 error

    Quote Originally Posted by warroyo90 View Post
    how can I make an ajax call to a php file that runs a query in zen cart ?
    The question is, why would you want to? Couldn't you use just plain javascript and/or PHP?

    Cheers
    Rod

  5. #5
    Join Date
    Jan 2012
    Posts
    59
    Plugin Contributions
    0

    Default Re: using jquery ajax POST method returning 500 error

    Quote Originally Posted by RodG View Post
    The question is, why would you want to? Couldn't you use just plain javascript and/or PHP?

    Cheers
    Rod
    well the reason I would want to is becuase I would liek to query the server on a keyup function and display the results in a div and also check to make sure the model # entered is in the db without doing page refresh ...if you think this could be accomplished more simply by javascript and php please give a in detail description I would love to know. I also have got it figured out and it is working great.

  6. #6
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: using jquery ajax POST method returning 500 error

    Quote Originally Posted by warroyo90 View Post
    well the reason I would want to is becuase I would liek to query the server on a keyup function and display the results in a div and also check to make sure the model # entered is in the db without doing page refresh ..
    You don't nedd AJAX for that, well not unless the site you are querying isn't the same site that you are making the query from.

    Quote Originally Posted by warroyo90 View Post
    .if you think this could be accomplished more simply by javascript and php please give a in detail description I would love to know.
    The answer is contained in my line above.

    Quote Originally Posted by warroyo90 View Post
    I also have got it figured out and it is working great.
    What did you do? Get rid of the AJAX call?

    If not, I'm interested how you did solve the problem, because I do have a real need for this, in that the data I'm after is on a remote server who's permissions deny such access.

    Cheers
    Rod

 

 

Similar Threads

  1. jQuery AJAX Manufacturer Filter
    By rbarbour in forum General Questions
    Replies: 4
    Last Post: 31 Dec 2013, 08:42 PM
  2. v151 jQuery ajax with type POST and securityToken
    By pasi in forum Contribution-Writing Guidelines
    Replies: 2
    Last Post: 26 Mar 2013, 10:38 AM
  3. v150 search option returning http 500 error - help
    By alibaba99 in forum General Questions
    Replies: 1
    Last Post: 21 May 2012, 03:24 AM
  4. Error 500 using Paypal
    By cutnscoot in forum PayPal Express Checkout support
    Replies: 7
    Last Post: 17 Aug 2010, 07:56 PM
  5. jQuery to Ajax: how to call application_top.php?
    By joomoo79 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Mar 2010, 09:07 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR