2

I have this function:

function formSubmitted(json, grandTotal) {

    $.ajax({
            type: "POST",
            url: "../quotes/create",
            data: {
                quote: {
                  name: json.name,
                  json: JSON.stringify(json),
                  email: json.email,
                  uid: json.id,
                  grand_total: grandTotal,
                  postcode: json.postcode,
                }
            },
             dataType:'text',
             success: function(data,status,xhr){
                console.log(status);
                alert("AWESOME!");

                window.location.assign("http://www.example.com/thanks?id=json.id")
             },
             error: function(xhr,status,error){
               console.log(status,error);
               alert("ERROR!");
             }

        });
}

It all works fine but what I want to do is redirect with window.location in the success: to

http://www.example.com/thanks?id=json.id

with json.id being the same as

uid: json.id,

In the code above. What do I need to do to make this work?

2
  • Perfect. Want to make it an answer and ill accept? Commented Oct 30, 2014 at 16:54
  • Better just close your question :) This is a simple typographical error and it doesn't really belong on SO. Commented Oct 30, 2014 at 16:56

1 Answer 1

2
function formSubmitted(json, grandTotal) {

    $.ajax({
            type: "POST",
            url: "../quotes/create",
            data: {
                quote: {
                  name: json.name,
                  json: JSON.stringify(json),
                  email: json.email,
                  uid: json.id,
                  grand_total: grandTotal,
                  postcode: json.postcode,
                }
            },
             dataType:'text',
             success: function(data,status,xhr){
                console.log(status);
                alert("AWESOME!");

                window.location.assign("http://www.example.com/thanks?id=" + json.id)
             },
             error: function(xhr,status,error){
               console.log(status,error);
               alert("ERROR!");
             }

        });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.