Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to redirect to a new page in jquery callback function
    primarykey
    data
    text
    <p>I am developing an application using jquery along with servlets.I have been using jquery theme roller for interface In my Login.jsp </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; $(document).ready(function() { $("#dialog").dialog(); }); &lt;/script&gt; &lt;script&gt; $("#submit").click(function(){ $("#LoginForm").submit(function() { var username=$("#username").val(); var password=$("#password").val(); var datastring='username='+username+ '&amp;password= '+password; $.ajax({ type: "POST", url:'Login', data: datastring error: function(){ alert("Data Error"); }, success: function (data){ window.location.replace("Items.jsp"); } }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body style="font-size:62.5%;"&gt; &lt;div id="dialog" title="Login"&gt; &lt;form id="LoginForm" method="post"&gt; &lt;fieldset&gt; &lt;label&gt;Username:&lt;/label&gt; &lt;input type="text" id="username"&gt;&lt;/input&gt;&lt;br&gt;&lt;/br&gt; &lt;label&gt;Password:&lt;/label&gt; &lt;input type="password" id="pwd"&gt;&lt;/input&gt;&lt;br&gt;&lt;/br&gt; &lt;input type="submit" id="submit" value="Log In" align="middle"&gt;&lt;/input&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p> </p> <p>The data is being passed to the servlet and once the login is successful i want the user to be redirect to a new page say Items.jsp. In my callback I have used <strong>window.location.replace("Items.jsp")</strong>.I am not able to redirect.</p> <p>I tried with <strong>response.sendRedirect("Items.jsp")</strong> and return *<em>"Items.jsp" *</em></p> <p>But am Not able to Redirect it to a new page.Where I am goin wrong..</p> <p>Thanks:)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload