简体   繁体   English

如何使用AJAX或PHP自动创建.js文件

[英]How do you automatically create .js files using AJAX or PHP

Is there a way to create a .js file using PHP or AJAX on a form submit? 有没有一种方法可以在表单提交中使用PHP或AJAX创建.js文件?

I have a short form that the user inputs tracking ID's into, when the form is submitted the IDs are saved into a mysql database. 我有一个简短的表单,用户可以输入跟踪ID,提交表单时,将ID保存到mysql数据库中。

At the same time as the form is submitted i want to automatically create a .js file that will be called the same as the submitted ID. 在提交表单的同时,我想自动创建一个.js文件,该文件将与提交的ID相同。

Here check this function in php http://php.net/manual/en/function.file-put-contents.php 在这里在php http://php.net/manual/en/function.file-put-contents.php中检查此功能

Call it in the page called in your submit 在您提交的页面中调用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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