Wednesday, November 3, 2010

Help with array

Does anyone know how to manually create an array in js that would mimic the data sent normally?

I simply need to send off 1 key => value pair  so it looks like data[‘model’][‘field’] => 0 since that is what the controller is expecting

 

Not using a form as what is being done is not possible….

 

The js has field value passed to it…just cant seem to get the array right.

 

 

SCRIPT (NOT CONTROLLER)

function update ( field , value ) {

 

var user_data= new Array()

                ????

                                 

$.ajax({

                                type: "POST",

                                cache:false,

                                url: '/user/update',

                                data:   user_data

});                          

}

 

Thanks,

 

Dave

No comments: