Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
How to send un-named XML data in POST body using HTML form?

This is my current request model (using AJAX XMLHTTP):

POST someURL/someURL/someURL HTTP/1.1
Host: xxx.yyy.com
Connection: close
Content-Length: 221
Origin: https://xxx.yyy.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Content-type: text/xml;charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8


<zadata>SOMEXMLDATA</zadata>
 

I'm just sending a un-named XML data in the body of AJAX XMLHTTP request.

I want to achieve the same without AJAX (using HTML FORM or some other method), as I'm requesting this resource from another domain, and I need to render the response directly in the webpage. (AJAX won't work due to SOP)

I tried many enctype in <form>, but couldn't achieve it. Help?

Update: I tried inserting one part of XML inside <input> name attribute, and another part inside <input> value attribute. Like this:

XML data: <zadata><param data=someValue></param></zadata>

<input type="text" name ="<zadata><param data" value="someValue></param></zadata>">

The request goes like this: %3Czadata%3E%3Cparam+data=someValue%3E%3C%2Fparam%3E%3C%2Fzadata%3E

The = symbol was inserted and the format is fine in request, but browser URL-encodes the content. Any way to prevent this encoding?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

This is impossible. That isn't a format supported by forms.

but browser URL-encodes the content. Any way to prevent this encoding?

… yes. Make it a multipart request instead. It will then be multipart encoded instead, which still isn't what you want.

You can't get the format you are asking for using a plain HTML form.

about 4 years ago · Santiago Trujillo Report

0

enctype attribute with value text/plain in <form> worked well. This is how I achieved it:

<form action="http://someURL.com" method="POST" enctype="text/plain">
<input type="text" name ="<zadata><param data" value="someValue></param></zadata>">
<input type="submit" value="Submit request">
</form>

The request model now:

POST http://someurl.com/ HTTP/1.1
Host: someurl.com
Content-Length: 47
Cache-Control: max-age=0
Origin: null
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Content-Type: text/plain
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Connection: close

<zadata><param data=someValue></param></zadata>
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!