vendredi 13 mai 2016

How to render js.erb file even though client expects html

I have a python script that sends data over to my ruby on rails app but expects html response back which is ok, but in my ruby on rails , when those data are sent i want to trigger a js.erb file while also sending an html response back to the python script.

How can i do that?

right now i have this

respond_to do |format|
      format.js
      format.html { head 200, content_type: "text/html" }
    end

and in python i have this

def send_results(results):
    url = "*******/results"

    data = urllib.urlencode(results)
    req = urllib2.Request(url, data)

    response = urllib2.urlopen(req)

    print response

Aucun commentaire:

Enregistrer un commentaire