Javascript doesn't work properly

gabry501

Member
I have a JS on an element, when from fronted I try to create a new form from the page:
Code:
http://localhost:8080/site/index.php/mazzi/form/8
it works
but when I try to editing from:
Code:
http://localhost:8080/site/index.php/mazzi/form/8/10
It does not.
Code:
var elementid = this.getValue();
var url = 'http://localhost:8080/site/index.php?option=com_fabrik&format=raw&view=plugin&task=userAjax&method=imgclasse';
    new Request(
    {
        url: url,
        data: {
            method: 'imgclasse',
            identify: elementid,
        },
        onComplete: function (r)
        {
            $('mazzi___display').innerHTML = (r);     
    }
}).send();
 
Can you be a bit more specific? "It does not" doesn't really tell us much.

is the JS runnong on load, or on change, or what?

Are you getting JS errors? If so, when and what?

You'll also have to show the PHP code for the 'imgclasse' method.

-- hugh
 
I'm sorry, I so here's the function on user_ajax
Code:
 <?php
defined( '_JEXEC' ) or die( 'Restricted Access' );
class userAjax
{
    function imgclasse( )
    {
        $result  = '';
        $db      = JFactory::getDBO();
        $IdClasse = JRequest::getVar( "identify", "" );
        $result  = '<ul>';
        $db->setQuery( "SELECT * FROM dka WHERE id = '$IdClasse'" );
        $row    = $db->loadObjectList();
        $rows  = $row[ 0 ];
 
      $result = $result . '<li style="list-style-type:none;text-align:none;margin-right:8px;"><img src="http://localhost:8080/site/' . $rows->Image . '"  ></li>';
 
        echo $result . '</ul>';
    }
}
?>

The js event is onChange. But even if I change the js code with
Code:
alert("test");
it doesn't show the popup, while it does on the creation form page.
So I think the problem is that js won't load.

I also made a custom js file form_8.js with a function calling a simple alert and it works only on the creation form page and not in the editing one.
Could you test if that problem affect only me?
 
Back
Top