A PHP Error was encountered
Severity: Notice
Message: Undefined index: userid
Filename: views/question.php
Line Number: 191
Backtrace:
File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler
File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view
File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once
Using AJAX to set selected language in Wordpress Session
I want to use a session in WordPress to store language selected by site visitors so that I can check the session and set the language in my site. I am new to WordPress so, I cannot figure out how would I go about calling a PHP file and setting the session data using jQuery. Am I going the wrong way about doing this? Is there an easier way of storing these variables and using them to change the front-end in WordPress?
I am trying to call a custom PHP script from jQuery as :
jQuery.ajax({ type: "POST", url: "set-language.php", data: 'en', });
but I am getting a 404 not found error.