I think u will need javascript to add the value to the select box. Do u use a js library like jQuery? U need to add the value to the select box with javascript after the user has created a new customer, or u can load the whole list again from database and put this list in the select box.
Thanks for the reply. I use jQuery for the modal box and several other things.
What I need is a method of retrieving the ID of the created customer and then pass that ID into the value of the select box.
Guess you can break it down to:
a) How do I retrieve the ID of the created customer? b) How do I pass that value into the select box?
superstoffer said:
Thanks for the reply. I use jQuery for the modal box and several other things.
What I need is a method of retrieving the ID of the created customer and then pass that ID into the value of the select box.
Guess you can break it down to:
a) How do I retrieve the ID of the created customer? b) How do I pass that value into the select box?
Since you're using jQuery, why not just have laravel return the newly created user in the reponse, like:
#lets imagine this is a resource controller
public function store(){
...
$user->save();
return Response::json($user, 200);
}
Then, get that data from your ajax success method, and then do an $('.dropDown').append('NEW USER OPTION TAG');
EDIT:
In jquery, you should use:
$.post(urlToSaveNewUser, data, function(response){
/* response will contain you new user data */
console.log(response);
}, 'json');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community