Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

dymanic data filter with jquery

Javascript • Asked by John Munyi

Hi Chris I want to replace the create action of my app with dynamic jQuery data pulling so that user has a chance to see the data pulled from the DB before the actual create happens , so currently my create action is then one doing all the dirty work but incase a user abort before updating then a dirty record is saved here it is

  def create
     @attendance_sheet =
     @team = Team.find(attendance_sheet_params[:team_id])
     @team.users.each do |u|

     respond_to do |format|
        format.html { render :edit }
         format.json { render :show, status: :created, location: @attendance_sheet }
         format.html { render :new }
         format.json { render json: @attendance_sheet.errors, status: :unprocessable_entity }

NB: I am rendering edit to give the user to update the pulled record of user accordingly ..... the attendances records added here are via nested attributes (not sure if it necessary to have that actually)

Now I am some jQuery in the line of :

 $(document).on 'ready page:load', ->
   list = $('.attendance').html() //this is the div to didplay users list from selected team
   $('#attendance_sheet_team_id').change ->

      team = $('#attendance_sheet_team_id :selected').text()

    //here now i wanna match the selected team with it users and show the hidden div with all the users from that team in it , this is the bit where i am stuck .. on how to grab the nested from and query as well 


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,575+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.