You are not logged in.

Important Note: This forum is being archived and will be completely locked down on the 7th of February. The new forum can be found at http://laravel.io.

Announcement

    Laravel 4 Advanced Architecture: Book Now On Sale

#1 2012-04-10 18:32:55

Syropian
Artisan
From: Toronto
Registered: 2011-07-30
Posts: 299
Website

How to access AJAX post data without serialization

I need to send an AJAX request to one of my POST routes - I'm only sending one piece of data, so I didn't feel the need to serialize the data.

So something like this

var task = prompt("Enter a task");
$.post("task/add", { name: task} );

How would I grab that name data var in my POST route?

Thanks! smile

Offline

#2 2012-04-10 18:39:24

hhorn
Artisan
From: Denmark
Registered: 2012-01-28
Posts: 17
Website

Re: How to access AJAX post data without serialization

Like you normally would grab any post data, I guess.

Input::get('name');

Offline

#3 2012-04-10 18:40:25

cviebrock
Artisan
From: Winnipeg, MB
Registered: 2012-02-11
Posts: 64

Re: How to access AJAX post data without serialization

It's just POST data so

Input::get('name')

should work, no?

Offline

#4 2012-04-10 18:50:30

Syropian
Artisan
From: Toronto
Registered: 2011-07-30
Posts: 299
Website

Re: How to access AJAX post data without serialization

Ha, well that was easy. For some reason I though Input::get() was locked into actual form elements. Thanks folks smile

Offline

Board footer

Powered by FluxBB

');