Skip to content

Instantly share code, notes, and snippets.

Created December 4, 2016 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/45f5e7c3af1bb101ca7e3858eeb663c2 to your computer and use it in GitHub Desktop.
Save anonymous/45f5e7c3af1bb101ca7e3858eeb663c2 to your computer and use it in GitHub Desktop.
<script>
function createFile()
{
var fileName;
fileName= prompt("Please enter file name:");
if (fileName != null )
{
if(fileName.trim()=="")
{
alert("File name must have some value");
}
else
{
alert("File is created");
jQuery.ajax(
{
type: "POST",
url: 'database_connections.php',
dataType: 'json',
data: {functionname: 'add', arguments: [fileName]},
success: function (obj, textstatus)
{
if( !('error' in obj) )
{
var yourVariable = obj.result;
}
else {
console.log(obj.error);
}
}
});
alert("File is created");
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment