Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Handle xhtml Request #1232

@miloit

Description

@miloit

Hello,
I tried to do a xhtml request

<script type="text/javascript">
    function test() {
	  var xhttp = new XMLHttpRequest();
          var devicename="";
          var j = {
            "first_name":"binchen",
            "last_name":"heris",
        };
	  xhttp.onreadystatechange = function() {
	    if (this.readyState == 4 && this.status == 200) {
		
			    } else {
	    console.log("unexpected response status " + this.status);
	    }
	  };
	  xhttp.open("GET", "/config", true);
	  xhttp.send(JSON.stringify(j));
	}

Here is my esp code

webServer.onRequestBody([](AsyncWebServerRequest * request, uint8_t *data, size_t len, size_t index, size_t total) {
    Serial.println("Running");
    if (request->url() == "/config") {
      
      request->send(200, "text/plain", "end");
    }
  });

But this is not working at all...any hints?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions