Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:56:29+00:00 2026-06-09T12:56:29+00:00

I display data via DataTable and detect when the user has selected a row.

  • 0

I display data via DataTable and detect when the user has selected a row. I want to then load the edit form for that row.

var oTable;

$(document).ready(function() {

/* Init the table */
TableTools.DEFAULTS.aButtons = [];
oTable = $("#neighbours").dataTable({
     sPaginationType: "full_numbers",
     bJQueryUI: true, 
     "bProcessing": true,
     "bServerSide": true,
     iDisplayLength: 25,
     sAjaxSource: $('#neighbours').data('source'),
     "aoColumns": [
        null,
        null,
        null,
        null,
        null
     ],
     "sDom": 'T<"clear">lfrtip',
     "oTableTools": {
       "sRowSelect": "single",
       "fnRowSelected": function ( node ) {
         var oTT = TableTools.fnGetInstance('neighbours');
         var aData = oTT.fnGetSelectedData();
         // alert (aData[0][4]);
        n = aData[0][4];
        $.get('edit/' + n); 
       }
     },  

});

My relevant controller code:

def edit
  logger.debug "Edit in Controller for Neighbour ID #{params[:id]}"
  @neighbour = Neighbour.find(params[:id])
  @localities = Locality.find(:all)
  @highways = Highway.find(:all)
end

I can see from the log that the correct id has passed to the controller and WebBrick reports that the view has been rendered as this extract shows.

Started GET "/neighbours/edit/39" for 127.0.0.1 at 2012-08-08 18:10:20 +1000
Processing by NeighboursController#edit as */*
Parameters: {"id"=>"39"}
Edit in Controller for Neighbour ID 39
Rendered neighbours/_form.html.erb (4341.0ms)
Rendered neighbours/edit.html.erb within layouts/neighbours (4410.0ms)
Completed 200 OK in 5564ms (Views: 4479.6ms | ActiveRecord: 28.0ms)

The view never shows in the browser. However if I enter localhost:3000/neighbours/edit/39 in the browser address bar, or place a link in the form header the view is rendered OK. The only difference I can see in the log is the line:

Processing by NeighboursController#edit as */*

With the direct load via the browser or the link it shows as:

Processing by NeighboursController#edit as HTML

Since the controller just gets the Id correctly in either case I am not sure what is wrong. Why does it matter if the id is passed by JavaScript? By the way, I have tried the same with different data sets, but with the same effect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:56:30+00:00Added an answer on June 9, 2026 at 12:56 pm

    Your controller for edit code might reveal the problem, the default code does only return data for HTML and JSon, so it probably returns nothing for this call. Consider always returning HTML by removing the case:

    this is the default code:

    respond_to do |format|
      format.html # new.html.haml
      format.json { render json: @shop }
    end
    

    and change that to force html to be returned by just calling render instead of this case statement.

    BTW: the */* stand for :all

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sending user data via jQuery to TCPDF, but it does not display any
I'm loading JSON data (array of objects) via service, onReady, and want to display
I want to display data in a tabular form using <ul> and <li> as
I want to display the data from xml to html via jquery I have
Consider the following code; it's basically a form that sends some data via HTTP
Is there an easy way to display xml data to a user via an
I'm using a CGridView on a website to display data provided via a CArrayDataProvider.
I am trying to display data that I am getting from server through json.
I want to display data in two columns as below Entry 1 Entry 2
I want to display data feed from an external database in a sidebar in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.