Jump to content

PHP form to redirect


patmcc76

Recommended Posts

I'm trying to edit a simple form that is on a site that was built by someone else.

 

It has a php file (leadSend.php) which contains the details for the mail recipient and then there is a js file (main.js) which contains the following:

 

 

>>>>>>>>>>>>>>>>>

 

// JavaScript Document

function sendForm() {

$.post('actions/leadSend.php', {name: $('#lname').val(), phone: $('#lphone').val()}, function(data) {

var s =data.status;

if(s===1) {

$('#boxContent').text('Thank you for getting in touch. One of our agents will call you on the number you provided during business hours.');

 

}else if(s===-1){

$('#lname').css('color','red');

alert('Please check the name you provided and try again');

}else if(s===-2){

$('#lname').css('color','#333');

$('#lphone').css('color','red');

alert('Please check the phone number you provided and try again');

}else{

alert('We\'re sorry but the information you submitted could not be sent. Please try again or call us on xxxxxxx');

}

}, 'json');

}

 

 

>>>>>>>>>>>>>>

 

 

At the moment when the user fills out the form, they get a text in place of the form saying "Thank you for getting in touch. One of our agents will call you on the number you provided during business hours.".

 

Is it possible to change this so that they get redirected to a new webpage?

 

Many thanks.

 

Pat.

Link to comment
Share on other sites

Change this:

if(s===1) {
         $('#boxContent').text('Thank you for getting in touch. One of our agents will call you on the number you provided during business hours.');
         
      }

 

to this:

 

if(s===1) {
         window.location = "http://www.google.com";      
      }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.