TMCO
39
11
General

Ajax POST – 500 Internal Server Error

Posted 3 years ago by TMCO

I'm trying to learn how to use AJAX in my Laravel application and I'm struggling with the POST method.

For testing, I've got a basic controller that simply returns true, but when I inspect my network tab, the AJAX POST to my controller is returning a 500 Internal Server Error.

$http.post('http://example.com/ajax/test', data).success(function(response) {
    alert(response);
}

public function test() {
    return true;
}

Any idea what could be going wrong?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.