PHP变量通过Ajax传递

时间:2015-03-09 10:33:28

标签: javascript php jquery ajax

我使用PulsePro作为CMS。模板在PHP上,但包含部分是HTML格式。 php邮件程序包含一个Ajax脚本,我在layout.php文件中实现了它。我有一些不同的形式与不同的接收者电子邮件addys。现在,我想为后续字符串定义一个变量。该变量将取自不同的包含部分,例如

这是包含文件中的链接。

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

这是layout.php文件中的ajax代码:

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();

感谢您的支持。

1 个答案:

答案 0 :(得分:0)

你可以输入像ifgForm这样的字符串

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

所以你可以在新变量字段中找到其他表单字段数据

相关问题