Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Finland
    Posts
    488
    Plugin Contributions
    3

    Default AJAX errors document.write

    I noticed that AJAX errors are being printed on to the document directly....

    jscript_framework.php
    Code:
             document.open();
             document.write(responseHtml);
             document.close();
    Should probaby change that behaviour to
    Code:
             console.log(responseHtml);
    Haven't got the time to go through the system, but it seems to have something to do with showing "raw" html error messages?

    But if there are other (non intended) errors, just printing the output brakes layout.
    Working with Zen Cart since 2003 :: www.prr.fi
    Author of the original Finnish language pack for Zen Cart since 2004

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

    Default Re: AJAX errors document.write

    Quote Originally Posted by pasi View Post
    I noticed that AJAX errors are being printed on to the document directly....

    jscript_framework.php
    Code:
             document.open();
             document.write(responseHtml);
             document.close();
    Those lines are not for error output. They are specifically for the intended payload. Changing them to console.log would completely break the whole purpose for adding the ajax support in the first place.

    Can you explain the specific errors you're encountering which led you to posting about this? Show us how to recreate your exact symptoms, so we can propose a proper fix.
    .

    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
    Mar 2004
    Location
    Finland
    Posts
    488
    Plugin Contributions
    3

    Default Re: AJAX errors document.write

    I noticed it as I got a PHP warning just under the body tag.... the ajax call returned:
    Code:
    {"data": true} PHP Warning: Some warning not relevant to this.
    And this did read just under the body tag (not visible in standard "view source", but webdeveloper addons "view generated source" which includes javascript output. Commenting out the document.write part sorted it.

    Obviously this is a developement version as I have errors on, so this would probably not be a problem in production enviroment.

    I got the idea of it being an error as the part of the code is wrapped in:
    .fail(function(jqXHR, textStatus, errorThrown) {

    But like I said, I haven't had the chance to check the code out much so am not 10000% sure.


    Unfortunately I can't remember which page this was on... I re-enabled the document.write and will give more info when/if I run to it again.
    Last edited by pasi; 18 Mar 2015 at 07:56 AM.
    Working with Zen Cart since 2003 :: www.prr.fi
    Author of the original Finnish language pack for Zen Cart since 2004

 

 

Similar Threads

  1. v151 Ajax onSubmit call to write an SQL flag in the database for a particular product
    By Chris Stackhouse in forum General Questions
    Replies: 1
    Last Post: 26 Feb 2015, 06:21 PM
  2. Write Reviews errors not going to the right page
    By lat9 in forum Addon Templates
    Replies: 3
    Last Post: 20 Oct 2009, 12:12 PM
  3. Errors in products_with_attributes_stock_4.7.ajax distribution
    By g.nencini in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 5 Jul 2009, 08:58 AM
  4. document.write Error?
    By kobra in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 26 Mar 2008, 02:40 AM
  5. Can anyone help a newbie? Write errors later in installation
    By bungle247 in forum Installing on a Windows Server
    Replies: 1
    Last Post: 10 Apr 2007, 10:10 PM

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