1
votes

I'm building a Joomla extension and i'm trying to send some data to a php script, with MooTools, to be saved in a database.

This is the code for the request :

    myReq: new Request({
        url: '/index.php?option=com_calculator&task=saveData',
        method: 'post',
        onSuccess: function (responseText, responseXML) {
            console.log(reponseText);
        }
    })

When i run it Firebug throws this error:

Permission denied for <http://localhost> to get property XMLHttpRequest.channel

I've read around and think it could be related to the same domain policy for Ajax,but i couldn't get a fix on it.

1
you are referencing a local file, after all--i doubt it's XSS policy. but isn't joomla mootools 1.1.2? the syntax you are using here is for 1.2+ - in 1.1 it was new Ajax(url, {options}).request(); if memory serves correctly. - Dimitar Christoff
i know,but in this case i am using mootools 1.2. I've figured it out eventually,the problem was in the url property.It should only be url: 'index.php' and the rest of the params get sent when i actually call the send method. - adivasile

1 Answers

0
votes

Try this:

var requestHTMLData = new Request.HTML ({

            url: 'index.php?option=com_calculator&task=saveData',

            update: $('contains')

        }).send();

$('contains') is those div id that your want to response.

for more info see Gantry Framework