0

Hello everyone

I am developing an application in which , i wrote the code for a pop up confirmation box in javascript, & when it presees ok , i want to call a PHP file from javascript......tried but not working......if anybody can help, would be great......

roja.

3
Contributors
2
Replies
8
Views
10 Years
Discussion Span
Last Post by katarey
0

I have the same problem - please help me out.

How can i call php file in javascript file..?? My pop ups are not working because of this.

Thanks in advance.
Thanks
harsh

0

Hi There,

I have Made Very Basic Example for you that will help you to understand how to use confirmation Box (confirm() JavaScript) in PHP

here is the code :

test.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Page</title>
<script type="text/javascript">
function confirmation(url, id) 
{
	var where_to= confirm("Do you really want Add the Value??");
		if (where_to== true)
			{
			window.location=url+"?"+id;
			}
			else
			{
			alert("Action Aborted By User!")
			}
} 
</script>
</head>
<body>
<a href="javascript:void(0);" onClick="confirmation('test.php', 'val=Just Testing')" id="links">Link Text</a>
<?php 
if($_GET['val'] != "")
	{
		echo "this value came From Last Page: ".$_GET['val']; 
	}
	?>
</body>
</html>

I hope this code will help you

Rahul Dev Katarey

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.