Support the ongoing development of Laravel.io →
Requests Input Session
Last updated 1 year ago.
0

Your article very good

I always code like you :)

But i think bester on success

success: function(response) {
	console.log(response);
	if(response.status == 'success'){
		// Action for success submit (update,post)
	}
	else{
		// Action for error
	}
}
0

Thanks, you are right I should have planned for a possible error. Maybe between my code and your added code, it will help someone. I admit my first post a couple weeks ago on this was hard to read the code.

Last updated 8 years ago.
0

I've extended the jquery ajax writing my own exception handler to show the user a js msg box.

When an error occurs in the laravel controller it throws an exception which will output a json string with the exception message as a response to the user. The ajax transport listener will show appropriate msg with the response.

0

I hate to spoil the party but do we really want this code on the forum as a Laravel example?

0

Well this is the way to post using jquery, and newbees ask this question over and over. Funny you didn't offer your solution with an example. No offence, but put up code or shut up should be the way it works.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jimgwhit jimgwhit Joined 13 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.