0
  vars["price"] = $('#awp_p_impact').val(); //here I will add plus the calculation of the heigh..
        vars["test"] = 100;
        vars["weight"] = $('#awp_p_weight').val();
        vars["quantity"] = $('#quantity_wanted').val();
        vars["quantity_available"] = $('#quantityAvailable').length?$('#quantityAvailable').html():awp_quantity;
        vars["id_product"] = $('#product_page_product_id').val();
        vars["awp_isie"] = ($.browser.msie?"1":"0");
        vars["allow_oos"] = allowBuyWhenOutOfStock?"1":"";

$.ajax({
        type: 'POST',
        url: baseDir + 'modules/attributewizardpro/combination_json.php',
        async: false,
        cache: false,
        dataType : "json",
        data: vars,

how to get/call the vars["test"] in the combinations_json.php ?

4
  • 1
    What does var_dump($_POST); give you in PHP when doing it this way? Commented Apr 16, 2013 at 23:21
  • I think you'd need to do data: { "vars":vars }, and then access it in PHP with $vars = $_POST['vars']. Commented Apr 16, 2013 at 23:23
  • Where do you want to get it? In the combination_json.php file? Or do you get some response from that file in the AJAX with the array included? Commented Apr 16, 2013 at 23:24
  • @IvoPereira yes in the combination_json.php file but as I can see there are no variables called from the file where the code you see above is. do you think ajax gets the values from the php? its my script Commented Apr 16, 2013 at 23:26

1 Answer 1

2

As you are posting your data via Ajax (an object that contain properties), all this stuff will be found in the global var $_POST on your PHP script.

You can have access to them with (for example):

$test = $_POST['test'];

// $test should contain "100"
Sign up to request clarification or add additional context in comments.

1 Comment

thank you this worked, I just need to see one more to get this done because it duplicates the value somewhere in the json.php file but your solution was the answer

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.