I have a button like so
{!! link_to_route('jobs.createJob', 'Create Job', $job->id, array('class' => 'btn btn-info')) !!}
So this route calls a function which does something like this
public function createJob(Job $job) {
$createJob = Helper::createNewJob($job);
$createJobXML = new \SimpleXMLElement($createJob);
if($createJobXML->Status == 'OK') {
$job->jobNumber = $createJobXML->Job->ID;
if($job->update()) {
$assignStaff = Helper::assignStaffToJob($job);
$assignStaffXML = new \SimpleXMLElement($assignStaff);
if($assignStaffXML->Status == 'OK'){
$createQuoteForJob = Helper::createQuoteForJob($job);
$createQuoteForJobXML = new \SimpleXMLElement($createQuoteForJob);
if($createQuoteForJobXML->Status == 'OK'){
$job->quoteId = $createQuoteForJobXML->ID;
if($job->update()) {
return View::make('jobs.show', compact('job'));
}
}
}
}
}
return View::make('campaigns.show', compact('job'));
}
So there is quite a lot going on which involves hitting several API methods to insert data into a system. This process can sometimes take a few seconds, and I do not want them being able to click the submit button again, so I want to show them a loading screen while this happens.
If I was making this request via ajax I could simple use ajaxStart and ajaxComplete. However, I am not using ajax, so is there another way I could do this within Laravel 5?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire