Ajax + qtranslate

2019-05-15 01:30发布

问题:

Hi I ran into the same problem as Rik had here

The answer given was that he had to "Search in code for link request "ajax.php". Replace "ajax.php" with ajax.php/?lang='.qtrans_getLanguage()" "

My question is this (I know it might sound stupid, I suck at this stuff), what code does this answer refer to and where do I find it? I've searched all php files in the qtranslate and ajax plugins but cannot find where it is.

回答1:

It depends on which WP ajax-plugin you have a problem with. In case "Category-Post AJAX Tree" I had to replace

$localize = array ('ajaxurl' => admin_url('admin-ajax.php'),

with

$localize = array ('ajaxurl' => admin_url('admin-ajax.php?lang='.qtrans_getLanguage()),

in cat-post-tree-ajax.php and to replace

var url = CatPostAjax.ajaxurl + '?action=myajax-submit&category=' + id; // compose url

with

var url = CatPostAjax.ajaxurl + '&action=myajax-submit&category=' + id; // compose url

in cat-post-tree-ajax.js. Please tell us what plugin you mean so we'll be able to help.