Using Ajax with Arduino Ethernet Shield

Hello, beginner here, I’m working on an oil valve remote control that uses an optical sensor to detect the number drops on a given time, I’m using an Ethernet Shield to send the number of degrees to turn a servo. I want to use Ajax to get the sensor info and show it on the page, for the purpose of simulation, I’m sending the degrees input to another Arduino and return it.

#include <Servo.h> 
#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>
#include <I2C_Anything.h>

String newString;
String readString;
Servo myservo;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 169, 254, 152, 120};
EthernetServer server(80);

void setup(){

    Wire.begin();
 
    pinMode(5, OUTPUT);

    Ethernet.begin(mac, ip);
    server.begin();
  
    Serial.begin(9600); 
    Serial.println(Ethernet.localIP());
  
    myservo.attach(9);
  }

void loop(){
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        if (readString.length() < 100) {
          readString += c; 
        } 
        if (c == '\n') {

          Serial.println(readString);
          
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>");
          client.print("<script   src='https://code.jquery.com/jquery-3.1.0.min.js'   integrity='sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s='   crossorigin='anonymous'></script>");    
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");
          client.print("<div class='container'>");
          client.println("<H1>Control de servo</H1>");
          client.print("  <div class='form-group'>");
          client.println("<FORM ACTION='/' method=get >");
          client.println("Ingrese gotas por minuto: <INPUT TYPE=TEXT NAME='LED' ID='GPM' VALUE='' SIZE='25' MAXLENGTH='50'>
");
          client.println("<BUTTON TYPE='BUTTON' ID='submit' CLASS='btn btn-default'>Ingresar</BUTTON>");
          client.println("</FORM>");
          client.print("  </div>");
          client.print("<script>");
          client.print("  $('#submit').click(function(){");
          client.print("          var gpm = $('#GPM').val();");
          client.print("          $.get('/',{gpm: gpm, x:1}, function(){})");
          client.print("  });");
          client.print("</script>");

          client.println("
");
          
          client.print("  </div>");
          
          client.println("</BODY>");
          client.println("</HTML>");

          delay(1);
          client.stop();

          if (readString.length() >0) {
            
              int pos1 = readString.indexOf('=');
              int pos2 = readString.indexOf('&');
              Serial.println(pos1);
              Serial.println(pos2);
              if (pos1>0 && pos2>0) {//Si se envia dato de giro
                newString = readString.substring(pos1+1, pos2);
                Serial.print("newString is: ");
                Serial.println(newString);
                float val = newString.toFloat();
                Serial.print("The value sent is: ");
                Serial.println(val);
                myservo.write((val*3));
            
                /*Wire.beginTransmission(8);
                float y = (60/val);
                float z = (y*1000);
                float a = (z-10);
                I2C_writeAnything (a);  
                Serial.println(a);
                Wire.endTransmission();
                delay(500);*/
                
                readString="";     
                newString=""; 
              }
          }

        }
      }
    }
  }
}

I still don’t have a proper idea on how to make that work, any help is welcome, thank you for your time.