message system and AJAX

More
3 years 1 month ago #9318 by llorca
llorca created the topic: message system and AJAX
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. :P

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);


}
}

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #9325 by marcin
marcin replied the topic: message system and AJAX
Hello,

System messages in Joomla are sensitive issue.
You can look for some ready solutions at Joomla Extensions Directory:
goo.gl/UJ7J4P

If you want us to deeply test and fix your code, you will need to contact our customization department via tickets for a quote.

Regards,
Marcin
Last Edit: 3 years 1 month ago by marcin.

Please Log in or Create an account to join the conversation.

Time to create page: 0.227 seconds

INDICO S.C.

ul. Wałowa 10/3, 84-200 Wejherowo, registered in Centralna Ewidencja i Informacja o Działalnosci Gospodarczej
NIP/VATID: PL5882424318

Copyright © 2009-2018 Joomla-Monster.com All rights reserved.

Joomla-Monster.com and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.