Skip to main content
added 263 characters in body
Source Link

Using AJAX call you can pass js values to PHP script. Suppose you are passing editId js value to logtime.php file.

$(document).ready(function() {

            $(".clickable").click(function() {
                var userID = $(this).attr('id');
                //alert($(this).attr('id'));
                $.ajax({
                    type: "POST",
                    url: 'logtime.php',
                    data: { editId : editId },
                    success: function(data)
                    {
                        alert("success!");
                    }
                });
            });
        });

<?php //logtime.php
$editId = isset($_POST['editId']);
//rest of code that uses $editId
?>
  Place the AJAX call after

then you can assign to your desired PHP variable.

$(e.currentTarget).find('input[name="editId"]').val(editId);
line in your js script. then you can assign to your desired PHP variable in logtime.php file

Using AJAX call you can pass js values to PHP script. Suppose you are passing editId js value to logtime.php file.

$(document).ready(function() {

            $(".clickable").click(function() {
                var userID = $(this).attr('id');
                //alert($(this).attr('id'));
                $.ajax({
                    type: "POST",
                    url: 'logtime.php',
                    data: { editId : editId },
                    success: function(data)
                    {
                        alert("success!");
                    }
                });
            });
        });

<?php //logtime.php
$editId = isset($_POST['editId']);
//rest of code that uses $editId
?>
 

then you can assign to your desired PHP variable.

Using AJAX call you can pass js values to PHP script. Suppose you are passing editId js value to logtime.php file.

$(document).ready(function() {

            $(".clickable").click(function() {
                var userID = $(this).attr('id');
                //alert($(this).attr('id'));
                $.ajax({
                    type: "POST",
                    url: 'logtime.php',
                    data: { editId : editId },
                    success: function(data)
                    {
                        alert("success!");
                    }
                });
            });
        });

<?php //logtime.php
$editId = isset($_POST['editId']);
//rest of code that uses $editId
?>
Place the AJAX call after

$(e.currentTarget).find('input[name="editId"]').val(editId);
line in your js script. then you can assign to your desired PHP variable in logtime.php file

Source Link

Using AJAX call you can pass js values to PHP script. Suppose you are passing editId js value to logtime.php file.

$(document).ready(function() {

            $(".clickable").click(function() {
                var userID = $(this).attr('id');
                //alert($(this).attr('id'));
                $.ajax({
                    type: "POST",
                    url: 'logtime.php',
                    data: { editId : editId },
                    success: function(data)
                    {
                        alert("success!");
                    }
                });
            });
        });

<?php //logtime.php
$editId = isset($_POST['editId']);
//rest of code that uses $editId
?>

then you can assign to your desired PHP variable.