Note that there are some explanatory texts on larger screens.

plurals
  1. POPOSTing via RoR getting back JSON, now what?
    primarykey
    data
    text
    <p>OK, I'm totally new to Ruby on Rails. I created a form that posts to an external widget that returns JSON. So I have this form: </p> <pre><code>&lt;%= form_for :email, :url =&gt; 'http://XXX.XX.XXX.212/widgetapi.0.1.php', :html =&gt; {:class =&gt; "new_email"} do |f| %&gt; &lt;%= f.text_field :email, :value =&gt; "Your email address...", :class =&gt; "text", :id =&gt; "email", :name =&gt; 'email', :onFocus =&gt; "change(this,'#222222'); this.value=''; this.onfocus=null;", :size =&gt; "26" %&gt; &lt;%= f.hidden_field :apiKey, :id =&gt; "apiKey", :name =&gt; 'apiKey', :value =&gt; "ABC123" %&gt; &lt;%= f.hidden_field :lrDomain, :id =&gt; "lrDomain", :name =&gt; 'lrDomain', :value =&gt; "signup.triplingo.com" %&gt; &lt;%= f.hidden_field :urlPrefix, :id =&gt; "refCodeUrl", :name =&gt; 'refCodeUrl', :value =&gt; "http://signup.website.com/" %&gt; &lt;%= f.hidden_field :ref_code, :id =&gt; 'ref_code', :name =&gt; 'ref_code', :value =&gt; @referralid %&gt; &lt;%= submit_tag "Enter To Win", :class =&gt; "button-positive submit" %&gt; &lt;% end %&gt; </code></pre> <p>Which works. Now I get back a JSON response that is:</p> <pre><code>({"email":"testing@testing2.com","reflink":"fi1ts","newuser":true}) </code></pre> <p>Ok now the result it the browser sits on the response page with the JSON. </p> <p>I'm guessing I need to do something with the @response in the controller, but I'm not sure what. All I want to do is if that "newuser" is true, provide them a success page. If false, go to an error page. </p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload