javascript - Prestashop Ajax Call Not Processing -
the code utilizing require_once
, wasn't executing, removing these , debugging problem solved
changed required include_once so
include_once(dirname(__file__).'../../../../config/config.inc.php'); include_once(dirname(__file__).'../../../../init.php');
are working, still cannot access database files
old edit ok so
`if (!defined('_ps_version_')) echo('no ps ');`
is echoing "no" return call of ajax call, have tried require_once(dirname(file).'../mymodule.php'); , gave me internal server error 500 in console.
every type of require_once call i've tried has given same error, including direct hardcoded directories, url links, different files, files in same directory, files in c , i've had no luck. older edit
ok, $_get showing data correctly passed ajax, require_once not working, ajax.php not executing @ all.
however, tools::getvalue not working, have not tried edit db don't think work since tools::getvalue causing error
end of edit
here's ajax call, urlvariable pointing http://myserverladidah/ajax.php , there's bunch of variables go along ?data= (some data) &moredata= (some more data)
it's redirecting correct controller, page redirect fine, nothing happening in ajax.php, i've cut ajax down writing hard-coded statement insert database there's nothing happening.
jquery.get(urlvariable, function (data) { window.location = 'index.php?controller=backendadminpage'; });
i've double checked url i'm calling, , variables checking out, can't these javascript variables database.
sorry insufficient information, hope helps // more information
var x = myfunction.getx; var y = myfunction.gety; var z = myfunction.getz; var urlvariable = '{$server}/modules/mymodule/ajax.php?x=' + x + '&y=' + y + '&z=' + z;
//ajax.php file
<?php require_once('../mymodule.php'); $sql = 'insert `ps_my_table` (`name`) values (`a`)'; db::getinstance()->execute($sql);
//previously php file tried values using tools, since nothing happening deleted code , tried above
ps_my_table (name
) values (' . tools::getvalue['x'] .'
)';
//variables dumping in javascript with
console.log(x); console.log(y); console.log(z);
//outputting
1 2 3
the code utilizing require_once
, wasn't executing, removing these , debugging problem solved.
the ajax script can use $_get manipulate data required.
Comments
Post a Comment