0

este es el error

index_for_we.html:42 POST http://181.61.221.52:8119/operative/simplecreateticket/ 400 (Bad Request) (anonymous) @ index_for_we.html:42 dispatch @ jquery.min.js:3 r.handle @ jquery.min.js:3 index_for_we.html:60 You saved this item {response_key: "c23603c223032a4b4653fe49c80191f4dfa88e6a", ERROR: "Se debe ingresar el nombre del contacto", VAL: "0"}

<html>
<title>Titulo de la web</title>
<meta charset="utf-8" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="prueba.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="alternate" title="Pozolería RSS" type="application/rss+xml" href="/feed.rss" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<head>
   
<script type="text/javascript">
 var $entidad = $('#entidad');
 var order_ent = {order_ent:$entidad.val()};
 var $name = $('#name');
 var order_name = {order_name:$name.val()};
 var $cedula = $('#cedula');
 var order_cedula = {order_cedula:$cedula.val()};
 var $mail = $('#mail');
 var order_mail = {order_mail:$mail.val()};
 var $phone = $('#phone');
 var order_phone = {phone:$phone.val()};
 var $fax = $('#fax');
 var order_fax = {order_fax:$fax.val()};
 var $dir = $('#dir');
 var order_dir = {order_dir:$dir.val()};
 var $city = $('#city');
 var order_city = {order_city:$city.val()};
 var $cargo = $('#cargo');
 var order_cargo = {order_cargo:$cargo.val()};
 var $description = $('#description');
 var order_description = {order_description:$description.val()};

 console.log(order_description,order_dir,order_cargo,order_city,order_fax,order_cedula,order_mail,order_ent)
 $(document).ready(function(){   
 $('#idBoton').click( function(){   
   
    fetch('http://181.61.221.52:8119/operative/simplecreateticket/', {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({"auth_key": "ffa07465e5af0a0f69d776e3a288dea1", 
   order_ent: $( "entity_number"), order_cedula: $("contact_identification"),
   order_name: $( "contact_name"),
    order_mail: $("contact_email"),
    order_phone: $("contact_phone"),
    order_fax: $("contact_fax"),
    order_dir: $("contact_address"),
   order_city: $("city_name") ,
   order_cargo: $( "contact_position_name"),
    order_description: $("description" ) })
   })
    .then(response => response.json()) // response.json() returns a promise
    .then((response) => {
      console.log("You saved this item", response); //returns the new item along with its ID
    })
});
 });
 </script>
</head>

<body>
      <div class="container" id="informacion">
    <form action="procesar.php" method="post" name="frm" >
       <div class="form-row">
<p id="server"></p>
    <div id="informacion">
        <ul></ul>
       <button id="clave"></button>
    </div>

<div id="informacion_2">
     <ul></ul>
<input type="number" id="entidad" value="4006">
<input type="text" id="nombre" value="valor">
<input type="number" id="cedula" value="valor">
<input type="mail" id="mail" value="valor">
<input type="number" id="phone" value="valor">
<input type="number" id="fax" value="valor">
<input type="text" id="dir" value="valor">
<input type="text" id="city" value="valor">
<input type="text" id="cargo" value="valor">
<input type="text" id="description" value="valor">

</div>
 <button type="button" id="idBoton" class="btn btn-primary" >envio</button>

</div>
</form>
</div>
</body>
</html>

1 respuesta 1

0

Te faltaron los .val() , los id.

$('#idBoton').click( function(){   

    fetch('http://181.61.221.52:8119/operative/simplecreateticket/', {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({"auth_key": "ffa07465e5af0a0f69d776e3a288dea1", 
   order_ent: $( "#entidad").val(),
 order_cedula: $("#cedula").val(),
   order_name: $( "#name").val(),
    order_mail: $("#mail").val(),
    order_phone: $("#phone").val(),
    order_fax: $("#fax").val(),
    order_dir: $("#dir").val(),
   order_city: $("#city").val(),
   order_cargo: $( "#cargo").val(),
    order_description: $("#description" ).val() })
   })

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.