dimanche 28 juin 2015

Load ajax success data on new page

My ajax call hits the controller and fetches a complete JSP page on success. I was trying to load that data independently on a new page rather than within some element of the existing page. I tried loading it for an html tag but that didn't work either. I tried skipping the success function but it remained on the same page without success data. My ajax call is made on clicking a normal button in the form and the code looks like as shown below.

$.ajax({

    url : '/newpage',
    type : 'POST',
    data : requestString,
    dataType : "text",
    processData : false,
    contentType : false,
    success : function(completeHtmlPage) {
        alert("Success");
        $("#html").load(completeHtmlPage);
    },
    error : function() {
        alert("error in loading");
    }

});

Aucun commentaire:

Enregistrer un commentaire