Welcome Guest, Not a member yet? Register   Sign In
Do I need a view for an animated JQuery ajax delete row?
#10

[eluser]gwerner[/eluser]
Ok. Still makes sense. Yes, the user must be authenticated and have privileges otherwise no access and they are taken to a login panel. So, I've got that covered. I didn't relaize you can check if the request is an AJAX request. Makes sense that you can though.

One last question. What is the best practice for handling the request if it is not AJAX? Considering I didn't even know you can check for this I'm curious what might be the best way to handle non-AJAX requests. My first inclination would to simply redirect or do nothing since the view the user would be on is the index. The controller below is only accessed if the user clicks the delete link or type in the URL. If they click the link all should be well. If they try to type it in then it should just do nothing. That's what the link is for?

Updated controller with AJAX check

Code:
// remove users controller
public function remove($userId)
{
  if ($this->input->is_ajax_request()) {
     // I'm AJAX!
     $this->data = $this->users_model->remove_users($userId);
  }
  else {
    // I'm NOT AJAX!
  }
}


Messages In This Thread
Do I need a view for an animated JQuery ajax delete row? - by El Forum - 06-01-2012, 02:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB