My Jquery code is

jQuery(".loginbtn").click(function(e) { 
                var value   =  JSON.stringify(jQuery(jQuery('#form-login input[class!="noAjax"]'), jQuery('#form-login')).serialize());
                alert(value); // here I am able to see "username=itsvalue&password&itsvalue...."
                jQuery.ajax ({                                                          
                        type    : "POST",
                        url     : "index.php?option=com_ajax&module=socialauth&method=loginUser&format=json",
                        data    : value,
                        contentType: "application/json",
                        success : function(response) {
                        error   : function(jqXHR, error, errorThrown) {  
                                jQuery("#login-msg").html(jqXHR.responseText + jqXHR.status); 
                                alert("Something went wrong");

Here is my PHP helper code:

public static function loginUserAjax() {
        // Required objects 
        $input      = JFactory::getApplication()->input; 

        var_dump((new JInput($input->get('data', '', 'array')))->getString('username') ); 

here I am not getting any POSTed data. I have tried many things. I don't know why.

1 Answer 1


I am not sure about $input->get('data', '', 'array'). Are you sure that data var is being passed?

I think you can simply use $input->getString('username') and so on to retrieve parts of the passed data query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.