Home>

there is a code

<
? php.
Class AjaxValidate {
    FUNCTION FORMVALIDATE () {
        //Put Form Elements INTO POST VARIABLES (This Is Wower You Would Sanitize Your Data)
        $ CategoryFlag= $ _ POST ['CategoryFlag'];
        $ subcategoryflag= $ _post ['subcategoryflag'];
        //Establish Values ​​That Will Be Returned Via Ajax
        $ Return= Array ();
        $ RETURN ['MSG']= '';
        $ Return ['error']= false;
        $ Return ['QueryConent']= '';
        $ Return ['Header']= 'Monoblocks';
        $ Return [CountRecords']= 0;
        Require_ONCE ('config.php');
        $ PDO= NEW PDO ($ DSN, $ User, $ Password);
        //Begin Form Validation Functionality
        if (! isset ($ subcategoryflag) || Empty ($ subcategoryflag)) {
            $ Return ['error']= True;
            $ Return ['MSG'].= '<
Li >
Error: Field1 is empty. ≪
/Li >
';
        }
        //Begin Form Success Functionality
        if (((! $ Return ['error']) &
&
 $ subcategoryflag== 'Monoblocks') {
            $ Return ['MSG']= '<
Div >
≪
DIV Class= "Filtercontainer" >
≪
div class= "filterseogroup filterseogroup__seo" id= "popularcollections" >
≪
H4 Class= "FiltersEogroup__Header" >
Popular selections <
/h4 >
≪
DIV Class= "FiltersEogroup__Group_closed" >
≪
div class= "filterseogroup__item-wrapper" >
≪
a class= "FiltersEogroup__item" href= "https://www.citilink.ru/catalog/monobloki--NEdorogie-Monobloki/" >
Inexpensive <
/a >
≪
/div >
≪
div class= "filterseogroup__item-wrapper" >
≪
a class= "FiltersEogroup__Item" href= "https://www.citilink.ru/catalog/monobloki--dlya-doma-m/" >
For home <
/a >
≪
/div >
≪
div class= "filterseogroup__item-wrapper" >
≪
a class= "filterseogroup__item" href= "https://www.citilink.ru/catalog/monobloki--dlya-ofisa-m/" >
For office <
/a >
≪
/div >
≪
div class= "filterseogroup__item-wrapper" >
≪
a class= "filterseogroup__item" href= "https://www.citilink.ru/catalog/monobloki--win/" >
with windows <
/a >
≪
/div >
≪
div class= "filterseogroup__item-wrapper" >
≪
a class= "filterseogroup__item" href= "https://www.citilink.ru/catalog/monobloki--imac/" >
Apple iMac <
/a >
≪
/div >
≪
/div >
≪
DIV Class= "FiltersEogroup__Toggle-Container" >
≪
Button class= "Filterseogroup__Toggle-Button ButtonStyleDecorator ButtonStyleDecorarator_Theme_GhostOrange ButtonStyleDecorator_Size_S Button" name= "" type= "submit" value= "" tabindex= "0" bordertyle= "none" >
≪
Span class= "Buttonstyledecorator__Text" >
Show all <
/span >
≪
/Button >
≪
/div >
≪
/div >
≪
/div >
≪
/div >
'
        }
            $ SQL= 'SELECT * from monoblocks';
            $ Query= $ PDO->
Prepare ($ SQL);
            $ Query->
Execute ();
            $ Return ['OutputText']= '<
Div style= "width: 100%; Border: 2px Solid # E31235" >
';
            While ($ example= $ Query->
Fetch (PDO :: Fetch_assoc))
            {
                //$ Return ['QueryConent']= '<
Div Style= "Width: 100%; Border: 2px Solid Red >
≪
/div >
';
                //$ RETURN ['OUTPUTTEXT'].= '<
DIV Class= "ProductCardblock" >
';
                $ sqloutput [$ i] [0]= $ example [2];
                $ i += 1;
                //$ RETURN ['OUTPUTTEXT'].= '<
/div >
';
            };
            $ Return ['OutputText'].= '<
/div >
';
            $ SQLCountRecords= 'Select Count (*) AS COUNT FROM Monoblocks';
            $ QueryCountrecords= $ PDO->
Prepare ($ sqlcountrecords);
            $ QueryCountRecords->
Execute ();
            $ Return [CountRecords']= $ QuerycountRecords->
fetch (pdo :: fetch_assoc) ['count'];
        //Return Json Encoded Results
        RETURN JSON_ENCODE ('RESULT'= >
 $ Return
                           'Output'= >
 $ sqloutput
        );
    }
}
$ ajaxvalidate= new ajaxvalidate;
Echo $ AjaxValidate->
FormValidate ();
? ≫

on the client Treatment

//the same code as the code above -only for black items of the MONOBLE menu items
        Let CategoryFlag= '';
            $ ('. submenu__title a'). ON ('Click', Function (EVENT) {
                event.preventDefault ();
                Console.log ('Inner Check');
                CategoryFlag= event.target.innerhtml;
                SubcategoryFlag= CategoryFlag;
                Console.log (CategoryFlag);
                $.ajax ({
                    Method: 'Post',
                    URL: '../PHP/ajaxSubcategory1.php',
                    Cache: False,
                    Data: {CategoryFlag: CategoryFlag, SubcategoryFlag: SubcategoryFlag},
                    Datatype: 'Json',
                    Complete: FUNCTION (DATA) {
                        Console.log (Data.header);
                        Console.log (data.countRecords);
                    }
                    SUCCESS: FUNCTION (DATA) {
                        Console.log ('Check');
                        Console.log (DATA);
                        $ ('. RightMenu'). HTML (Data.Result.msg);
                        Let Centeroutput= '<
DIV ID= \ "TOPCENERAREA \" >
'+' ≪
H1 >
'+ Data.Result.Header +' '+ Data.Result.countRecords +' Goods '+ Data.Output.0.0 +' <
/h1 >
'+' ≪
/div >
';
                        /*$('.Centerea'M) .html('Lt;
DIV ID= \ "TOPCENERAREA \" >
'+' ≪
H1 >
'+ Data.Header +' '+ Data.CountRecords +' Goods '+' <
/h1 >
'+' ≪
/div >
'); * /
                        $ ('. Centerarea'). HTML (CENTEROUTPUT);
                        //ExpandCollapsedFunction ();
                }
            }
            );
        }
        ); 

As a result, an error occurs

Uncaught Syntaxerror: UNEXPECTED NUMBER TESTSITE.HTML: 563

(string

Let Centeroutput= '<
DIV ID= \ "TOPCENERAREA \" >
'+' ≪
H1 >
'+ Data.Result.Header +' '+ Data.Result.countRecords +' Goods '+ Data.Output.0.0 +' <
/h1 >
'+' ≪
/div >
';

)

How to eliminate this error? MONOBLOCKS Table has

  • Answer # 1

    Appeal to the elements of the array is performed through the indication of the index in square brackets Data.Output [0] [0]

  • Answer # 2

    Appeal to the elements of the array is performed through the indication of the index in square brackets Data.Output [0] [0]