Can't handle JSON response with ajax bind successHow do I format a Microsoft JSON date?In Rails 3 and jQuery, need to receive JSON data in an ajax:successAjax request returns 200 OK, but an error event is fired instead of successAjax success event in Rails 3jquery AJAX and json formatCan't get JSON in Railsaction mailer for rails 4Getting “First argument in form cannot contain nil or be empty” errorWhy Ajax success not called when JSON passed through Django?Rails Dot in Url with two routes for one controller

Do things made of adamantine rust?

As an employer, can I compel my employees to vote?

Wired to Wireless Doorbell

Which museums have artworks of all four ninja turtles' namesakes?

Do household ovens ventilate heat to the outdoors?

What did the controller say during my approach to land (audio clip)?

Is it really necessary to have 4 hours meeting in Sprint planning?

Shimano 105 FD-R7000-F front dereailleur chain rub

Does Rayami, First of the Fallen exile it self?

Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?

Why would a fighter use the afterburner and air brakes at the same time?

Can you pray or study torah in a non-Jewish cemetery?

Debussy as term for bathroom?

What is the need of methods like GET and POST in the HTTP protocol?

Minimize taxes now that I earn more

What was an "insurance cover"?

Is it safe to unplug a blinking USB drive after 'safely' ejecting it?

Is there an in-universe reason Harry says this or is this simply a Rowling mistake?

Why there so many pitch control surfaces on the Piaggio P180 Avanti?

Do liquid propellant rocket engines experience thrust oscillation?

How do rulers get rich from war?

Is the sentence "何でも忘れた" correct?

As a discovery writer, how do I complete an unfinished novel (which has highly diverged from the original plot ) after a time-gap?

Is there a connection between IT and Ghostbusters?



Can't handle JSON response with ajax bind success


How do I format a Microsoft JSON date?In Rails 3 and jQuery, need to receive JSON data in an ajax:successAjax request returns 200 OK, but an error event is fired instead of successAjax success event in Rails 3jquery AJAX and json formatCan't get JSON in Railsaction mailer for rails 4Getting “First argument in form cannot contain nil or be empty” errorWhy Ajax success not called when JSON passed through Django?Rails Dot in Url with two routes for one controller






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm doing a simple calculation using a form with AJAX. The form sends the parameters, the controller receives it, do the calculation and return the result.
The results are all the expected and I can see them in the shell but can't send this to the view.



I'm using data-remote="true" in the form, so I'm returning the JSON like this:



def calculator 
respond_to do |format|
format.json render json: result_plano, status: :ok
end
end


And the jQuery:



$("#calculator").bind("ajax:success", function(data)
alert(data);
);


But it keeps returning undefined










share|improve this question


























  • Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

    – NM Pennypacker
    Mar 28 at 14:39











  • Yes, it's returning results. I've just skipped this part of the code

    – lufizi
    Mar 28 at 14:51











  • What happens if you replace alert(data); with console.log('something');?

    – NM Pennypacker
    Mar 28 at 15:57

















0















I'm doing a simple calculation using a form with AJAX. The form sends the parameters, the controller receives it, do the calculation and return the result.
The results are all the expected and I can see them in the shell but can't send this to the view.



I'm using data-remote="true" in the form, so I'm returning the JSON like this:



def calculator 
respond_to do |format|
format.json render json: result_plano, status: :ok
end
end


And the jQuery:



$("#calculator").bind("ajax:success", function(data)
alert(data);
);


But it keeps returning undefined










share|improve this question


























  • Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

    – NM Pennypacker
    Mar 28 at 14:39











  • Yes, it's returning results. I've just skipped this part of the code

    – lufizi
    Mar 28 at 14:51











  • What happens if you replace alert(data); with console.log('something');?

    – NM Pennypacker
    Mar 28 at 15:57













0












0








0








I'm doing a simple calculation using a form with AJAX. The form sends the parameters, the controller receives it, do the calculation and return the result.
The results are all the expected and I can see them in the shell but can't send this to the view.



I'm using data-remote="true" in the form, so I'm returning the JSON like this:



def calculator 
respond_to do |format|
format.json render json: result_plano, status: :ok
end
end


And the jQuery:



$("#calculator").bind("ajax:success", function(data)
alert(data);
);


But it keeps returning undefined










share|improve this question
















I'm doing a simple calculation using a form with AJAX. The form sends the parameters, the controller receives it, do the calculation and return the result.
The results are all the expected and I can see them in the shell but can't send this to the view.



I'm using data-remote="true" in the form, so I'm returning the JSON like this:



def calculator 
respond_to do |format|
format.json render json: result_plano, status: :ok
end
end


And the jQuery:



$("#calculator").bind("ajax:success", function(data)
alert(data);
);


But it keeps returning undefined







jquery ruby-on-rails






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 15:59









NM Pennypacker

5,23211 gold badges25 silver badges32 bronze badges




5,23211 gold badges25 silver badges32 bronze badges










asked Mar 28 at 14:33









lufizilufizi

813 silver badges10 bronze badges




813 silver badges10 bronze badges















  • Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

    – NM Pennypacker
    Mar 28 at 14:39











  • Yes, it's returning results. I've just skipped this part of the code

    – lufizi
    Mar 28 at 14:51











  • What happens if you replace alert(data); with console.log('something');?

    – NM Pennypacker
    Mar 28 at 15:57

















  • Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

    – NM Pennypacker
    Mar 28 at 14:39











  • Yes, it's returning results. I've just skipped this part of the code

    – lufizi
    Mar 28 at 14:51











  • What happens if you replace alert(data); with console.log('something');?

    – NM Pennypacker
    Mar 28 at 15:57
















Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

– NM Pennypacker
Mar 28 at 14:39





Have you verified that result_plano is returning results? Also, you might have to call to_json on that unless it's already being converted

– NM Pennypacker
Mar 28 at 14:39













Yes, it's returning results. I've just skipped this part of the code

– lufizi
Mar 28 at 14:51





Yes, it's returning results. I've just skipped this part of the code

– lufizi
Mar 28 at 14:51













What happens if you replace alert(data); with console.log('something');?

– NM Pennypacker
Mar 28 at 15:57





What happens if you replace alert(data); with console.log('something');?

– NM Pennypacker
Mar 28 at 15:57












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400217%2fcant-handle-json-response-with-ajax-bind-success%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400217%2fcant-handle-json-response-with-ajax-bind-success%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴