post serialized data through using jquery load method in codeigniter post serialized data through using jquery load method in codeigniter codeigniter codeigniter

post serialized data through using jquery load method in codeigniter


Using JQuery's load function (JQuery API)

POST method is used if data is provided as an object; otherwise, GET is assumed.

Per JQuery's definition of the serialize function

The .serialize() method creates a text string in standard URL-encoded notation.

That said, you're attempting to get a POST variable when GET is assumed, as it's not an object being passed to the load function, it's a string.

Try using $this->input->get('parameter_name')

As a sidenote, you may be able to get the data points as function parameters: function addat($name, $email){ as codeigniter usually will accept that method of getting GET params.


serialize method create a string output. to Make a POST call you need to use JSON object.

$('#user').on('submit',function(event){        event.preventDefault();        var data=formToJSON('#user');        adddetails(data);});function adddetails(data){        var url='http://localhost/projectname/index.php/users/adddat';        $("#output").load(url,data,function(response,status){        });}function formToJSON( selector ){     var form = {};     $(selector).find(':input[name]:enabled').each( function() {         var self = $(this);         var name = self.attr('name');         if (form[name]) {            form[name] = form[name] + ',' + self.val();         }         else {            form[name] = self.val();         }     });     return form;}

Credit Convert form data to JavaScript object with jQuery