php - Sending an array to a function in codeigniter -


i have following codes sends array function /chat in codeigniter

$(document).ready(function () {     $('#submit').live('click', function (eve) {         eve.preventdefault();         $.ajax({             url: "http://localhost/fq/index.php/splash/chat/",             type: 'json',             data: a,             success: function (html) {                 alert(html);             }         });     }); 

let assume array contains names of people only. ( john, james, smith)

i want able retrieve values array in function chat.

how can done?

edit:

i need retrieve values json encoded array in function (codeigniter)

   public function chat() {     //code retrieve values    $this->load->view('chat');  } 

  data: a, 

should

  data: $('form').serialize(), // 'form' may need replace form selector 

but if want send array ['john', 'james', 'smith']... yours fine.

and use datatype: 'json' configuration if you're expecting object response or datatype: 'html' html response.

setting datatype release parsing effort.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -