Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect from external page after ajax submit
    primarykey
    data
    text
    <p>Hello i'm using an ajax script redirecting to a php page where i make the validation. After there are no validation errors i want to redirect to another page but i cant manage to make it work. here is my script:</p> <pre><code>&lt;script type="text/javascript" src="js/jquery.form.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" &gt; $(document).ready(function() { $("#imageform").ajaxForm({ target: \'#preview \', }); }); &lt;/script&gt; </code></pre> <p>and here is the external php were i make the validation</p> <pre><code>&lt;?php require_once('../core/dbconfig.php'); mysql_query("SET NAMES utf8"); $fname=$_POST['name']; $email=$_POST['email']; $country=$_POST['country']; $city=$_POST['city']; $type=$_POST['type']; $story=$_POST['story']; $cookie=$_COOKIE['cookie']; $sizee = $_FILES['img1']['size']; if (!$fname or !$city or !$email or !$country or (!$story &amp;&amp; $sizee==0)) { if ($sizee==0 &amp;&amp; !$story) { echo'&lt;p style="color:red;"&gt;Please upload a photo or type your story.&lt;p&gt;'; } if(!$fname) { echo'&lt;p style="color:red;"&gt;Please enter your name.&lt;p&gt;'; } $regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/'; if (preg_match($regex, $email)) { } else { echo'&lt;p style="color:red"&gt;Please enter a valid email.&lt;p&gt;'; } if(!$country) { echo'&lt;p style="color:red"&gt;Please select your country.&lt;p&gt;'; } if(!$city) { echo'&lt;p style="color:red"&gt;Please enter your city.&lt;p&gt;'; } } else { .... } </code></pre> <p>what i want to achiev is that after all the conditions are completed to redirect to a confirmation page. If i use a succes:window.location.href = "example.php" doesnt work as intended. Thnx in advance.</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.
    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.
    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