0

I have created a simple custom web page using HTML and JavaScript, that allows a user to select multiple languages of their choice to translate text.

For example, lets say the user chooses English(en-US) and French(fr-FR) and clicks on "Submit". I want to take the user's request, and send that data to an [Azure Logic HTTP End Point][1] where I have set up my JSON schema to take "languages" property of type "array". The JSON schema is defined on the HTTP Trigger like below :

Peter
  • 71
  • 1
  • 10

1 Answers1

1

enter image description hereyou can check the network tab in the dev tool and from what i see is that your page is sending the data in json format. however the there is an error on parsing the response body(check out your end point's response).enter image description here

Alan Omar
  • 4,023
  • 1
  • 9
  • 20
  • Hi, I don't think I am following you. What do suggest that needs to be fixed? – Peter Apr 20 '20 at 22:02
  • Hello @Peter the response from your end point is malformed. that why it can not be displayed in this line `console.log('got result:', result)`. – Alan Omar Apr 20 '20 at 22:12
  • Hi @alan, so how I go about fixing it? Is that something wrong with my JavaScript? – Peter Apr 20 '20 at 22:13
  • No your js is OK but you have to check the backend(the end point). – Alan Omar Apr 20 '20 at 22:15
  • what is the response should be? just a confirmation message? – Alan Omar Apr 20 '20 at 22:16
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/212116/discussion-between-peter-and-alan-jouhar). – Peter Apr 20 '20 at 22:19
  • Hi Alan, I have a question: On Form Submit, how do we include Video ID query parameter in the URL for the fetch call? (For e.g: https://jsfiddle.net/peterlearning/03dcxer7/1?id=b67c519778) . So that the web page can extract and include in the request. I am not sure how to apply the "window.location.href" in my scenario. I tried to follow this example: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript but I am not having must success in my case. – Peter Apr 23 '20 at 20:19