Hello,
I want to send a system message, using JAVASCRIPT. The parameters are 'the message' and 'message type'.
So I created the PHP code and JAVASCRIPT code. nothing happens.
Variables are OK and tested to $message and $type.
there 's no errors in execution.
if someone has an idea. thank you.
code PHP:
<?php
// envoyer un message en utilisant les messages système joomla
$message= $_GET;
$type= $_GET;
define('_JEXEC', 1 );
define('JPATH_BASE', $_SERVER);
define('DS', DIRECTORY_SEPARATOR);
require_once(JPATH_BASE .DS.'configuration.php');
require_once(JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once(JPATH_BASE .DS.'includes'.DS.'framework.php');
require_once(JPATH_BASE .DS.'libraries/loader.php');
require_once(JPATH_BASE .DS.'libraries/joomla/factory.php');
JLoader::import( 'joomla.factory');
$app = JFactory::getApplication('site');
$app->initialise();
$app->enqueueMessage($message, $type);
echo true;
?>
code JAVASCRIPT:
function messageInfo(message,type){
if (ajax)
{
//url pour récupérer la commune dans la table AEan_communes en fonction du CP
var url = "scripts/message.php";
var param = "?message=" + escape(message) + "&type=" + escape(type);
ajax.open("GET", url + param, true);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
essai = ajax.responseText;
alert(essai);
//Joomla.renderMessages("json");
}
}
ajax.send(null);
}
}