Jump to content

BuissonArdent

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by BuissonArdent

  1. Thank you very much for your time Barand ! really. After several tries, I still can't get it to "POST", with the parameter method: "POST", Or change $.ajax to $.post The problem is that doing this "deactivates" the script and returns a blank page ! However, for those interested, after several tries, modifying the url and adding the parameter ?page=test does not modify the values of my variables ! In any case, thank you very much. Because now I have learned to pass variables in GET with ajax Best regards. BuissonArdent.
  2. Ohh ! It's works ! Thank you for that 🙂 I'm telling me "why ?", because the url don't have any parameters in (like ?page=value) Do you know if I can use POST method with my script ? How tell to AJAX to use POST method with my refreshing script ?( I am afraid / and not wanting someone to modify the parameter in the url (even if post can be modified too)) I have try $.POST before (and in too) $.AJAX but it not working for me ... Ty
  3. Hello Barand, I have try your code solution, but that don't works ... Ajax works, like before posting my problem here. But the variable cannot be send ... Here my index and script, can you decel any problem in my typo ? INDEX <?php $PAGE ="its works"; ?> <input type="hidden" name="page" id="page" value="<?php echo $PAGE; ?>" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> <script type="text/javascript"> var page = $("#page").val() function refreshh() { $.ajax({ url: "script.php", data: {"page":page}, ifModified:true, success: function(content){ $('#notif').html(content); // <div> to refresh } }); setTimeout(refreshh, 1000); // (1 min = 60000) } refreshh(); </script> <div id="notif"></div> SCRIPT <?php if (isset($_POST['page'])) { $variable = $_POST['page']; } else { $variable = "doesn't work !"; } echo "<br />echo Svariable : " . $variable . "<br /><hr /><br/>" . "echo S_POST page : " . $_POST['page']; ?> I have also tryed without the "data:" but it return me an error .. Thanks for your time 🙂
  4. Ohh thakn you for the answer, I try it later and give full code if works. Thanks for the translation ! I mistake it
  5. J'ai entendu parler du paramètre AJAX "data", mais je ne trouve pas de réponse concrète pour "passer" mes variables Comment faire comprendre à AJAX qu'il à besoin de mes variables ??
  6. Hello everyone, I have a problem with AJAX, and PHP variables ... I am using a script (script.php) which contains database writing. In the page where I am calling this script, I set the variables so that the script understands which page I am calling it from. For example, in index, I set $PAGE = "INDEX"; or in contat, $PAGE = "CONTACT". This allows script.php to know where to write to the database. (The $PAGE variable is equal to the column name) Apparently the AJAX call doesn't know any of the variables I set in the index. This looks like a separate request to script.php, however, how do you get AJAX to have access to these variables? This would prevent me from doing one script per page ... Understand that having index_script, contact_script, about_script, etc ... That quickly becomes embarassing in my folder .. There my index code. (I call it twice (include and ajax refresh) because i have two actions in script.php, on refresh, and on load) <?php $PAGE = "INDEX"; // MY VARIABLE (ONE FOR THE EXEMPLE, BUT REALLY 7 OR 8) include('script.php'); // INCLUDE FIRST, DO THE FIRST ACTION ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> <script type="text/javascript"> function refreshh() { $.ajax({ url: "script.php", ifModified:true, success: function(content){ $('#notif').html(content); // <div> to refresh } }); setTimeout(notif, 1000); // (1 min = 60000) } refreshh(); </script> <div id="notif"></div> If anyone have a solution for let ajax access to my variables 🙂 thank you
×
×
  • 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.