简体   繁体   中英

PHP variable pass through Ajax

I have PulsePro as CMS used. The template is on PHP, but the include parts are in HTML. The php mailer contains an Ajax Script, which I have implemented in the layout.php file. I have some different forms with different receiver email addys. Now, I want to define a variable for following string. This variable it will taken from the different include parts, eg

Here the link in the include files.

<?php $variable ="ajax1.php"; ?> 

This is the ajax code in the layout.php file:

ajaxSubmit = function(){
            var frmData = $("#ifgForm").serialize();
            $.ajax({
                **url: "/includes/ajax.php", This is the original part, but here should be the variable
                data:     frmData,
                type:     "POST",
                dataType: "json",
                success: function(response){
                    $("#f1_upload_process").hide();
                    $(".event-submit-btn").show();

Thanks for your support.

You can output the string inside ifgForm like this

<form id="ifgForm">
   <!-- [....] -->
   <input type="hidden" value="<?=$variable?>" name="variable" id="variable"> 
   <!-- [....] -->    
</form>

So u can find in the new variable field with other form fields data

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM