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

  • SEARCH
  • Home
  • 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 6372257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:12:50+00:00 2026-05-25T01:12:50+00:00

I am getting a status of 404 Not Found when trying to submit an

  • 0

I am getting a status of 404 Not Found when trying to submit an Ajax request to one of my controllers.

Here is my form:

<%= nested_form_for @estimate do |f| %>

<%= f.label :date %><br />
<%= f.text_field :date %><br />
<%= f.label :job_name %><br />
<%= f.text_field :job_name %><br />

<%= f.fields_for :items do |builder| %>

  <%= builder.label :properties %><br />
  <%= builder.text_field :properties, :id => "properties_field" %><br />
  <%= builder.label :height %><br />
  <%= builder.text_field :height, :id => "height_field" %><br />
  <%= builder.label :letter_quantity %><br />
  <%= builder.text_field :letter_quantity, :id => "letter_quantity_field" %>
  <%= builder.link_to_remove "Remove this item" %>
<% end %>
<%= f.link_to_add "Add a item", :items %>
<%= f.submit "Add item" %>

<% end %>

<script type="text/javascript">

    $("#letter_quantity_field").blur(function() {
        var height = $("height_field").val();
        var properties = $("properties_field").val();
        $.ajax({
          url: '/estimates/calculateCost?height=' + height + '&properties=' + properties , type: 'get', dataType: 'html',
          processData: false,
          success: function(data) {
            if (data == "record_not_found") {
              alert("Record not found");
            }
            else {
              $("#letter_quantity_field").val(data);
            }
          }
        });
    });

</script>

And here is my controller:

class EstimatesController < ApplicationController
    .
    .
    .
    def calculateCost
      cost_data = CostData.find_by_properties_and_find_by_height(params[:properties], params[:height])
      if @cost_data.blank?
        render :text => "record_not_found"
      else
        render :text => @cost_data.unit_price
      end  
    end

end

I have been Googling for hours on this one. Any help will be greatly appreciated.

  • 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-05-25T01:12:51+00:00Added an answer on May 25, 2026 at 1:12 am

    In your routing, you need to ensure that calculateCost (which, by the way, should be calculate_cost in the ruby world) is a collections route not a member route because you are not specifying the id.

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

Sidebar

Related Questions

Im trying to achieve an output like this {status:ok,0:{id:11,title:digg,url:http://www.digg.com}} but instead i am getting
This partially mimics AJAX (prototype/php) getting partial status updates during script execution , however
I send a rest request to a server and getting back a status 200
I'm trying to run command qstat but instead of getting the queue status I'm
For some reason one particular AJAX call of mine is getting a No parameterless
I'm getting the error The request failed with HTTP status 401: Unauthorized whenever I
I don't know why I'm getting (bin) in the file status - I checked
I'm getting this exception from facebook SDK: Fatal error: Uncaught OAuthException: (#506) Duplicate status
I'm getting error when I try setting status to empathy with dbus using python,
This code is from my C# WPF application: public MainWindow() { InitializeComponent(); status(Getting dl

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.