Welcome Guest, Not a member yet? Register   Sign In
CI jQUERY ajax POST data
#4

[eluser]jdfwarrior[/eluser]
I think I found your issue. You are using the AJAX function to post to the function. With a POST, you have to specify a name for the data that you are passing.

There are several examples listed in the jQuery documentation.
http://docs.jquery.com/Ajax/jQuery.ajax#options

Basically, where you set your data, it should read something like..
Code:
$.ajax({
  type: ‘POST’,
  url: ‘homepage/readarticle’,
  data: "active="+ active,
  success: function(databack){
    $(’#artcontent’).append(databack);
    }
  })
});

or

Code:
$.ajax({
  type: ‘POST’,
  url: ‘homepage/readarticle’,
  data: ({active : active}),
  success: function(databack){
    $(’#artcontent’).append(databack);
    }
  })
});

If the above code, the first mention of active, would be a field/named reference for the data. Allowing you to use $this->input->post("active"). The second mention would be the value that you are passing to it.
Remember when your posting data, it typically uses the field name as that identifier.. with an ajax post, you have to give it a name.

Try that out and see if it works.

Good luck


Messages In This Thread
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 04:13 PM
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 04:27 PM
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 05:08 PM
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 05:26 PM
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 05:43 PM
CI jQUERY ajax POST data - by El Forum - 10-07-2009, 05:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB