By clicking on the POST link on the page you are not triggering the onchange ajax event to save the changed field

Saving the field on ajax change to the server works when clicked outside of the field, but doesn't change the value if you click on any POST link on the page immediately after changing the value.

Below is the html code:

<input type="text" name="title" id="title" size="40" value="${fieldValue}" onchange="doAJAXSubmit(this.name, this.value)"/>

      

JS:

function doAJAXSubmit(fieldSaved, fieldValue)
{
    alert(fieldSaved);
    var url = "<c:url value="/home/home.jsp"/>";

    url = url+fieldSaved+ "=" + fieldValue;
    new Request({url: url}).send();
}

      

+3


source to share


1 answer


Have you tried document.ready.change with jquery

$('#title').change(function() {
    alert(fieldSaved);
    var url = "<c:url value="/cart/view_cart.jspa"/>";

    url = url+fieldSaved+ "=" + fieldValue;
    new Request({url: url}).send();
});

      

Without JQuery, do the following: Then change your code to the following:



using onkeyup

<input type="text" name="title" id="title" size="40" value="${fieldValue}" onkeyup="doAJAXSubmit(this.name, this.value)"/>

      

0


source







All Articles