开发者

php post without form

I have a php page that takes some get strings, after some user interaction I want to continue executing some php code without navigating or refreshing the page so that its smooth and doesn't flicker. Ive tried secretly clicking invisible forms and it always refreshes, how can achieve this?

Also as a side note, I am using jquery but I was not able to get that post function up and running, I will keep trying it but let me know if that is a wrong solution.

//gallery.php 
//jquery
$(".download").click(function()
{
    $.post("gallery.php", { images: "testing it out" } );
});

<?php

if(isset($_POST['images']))
{
echo "It worked";
}
else if(isset($_GET['artist'])开发者_StackOverflow)
{
echo "It worked2";
}

?>

They are both in the same page, the get always works because I pass the info though the url from another page. But the .download click doesnt cause the php code under post to execute


Use Ajax to send a HTTP request in the background.


Using Ajax is the solution...

You can try with jQuery, read this link http://api.jquery.com/jQuery.post/


jquery ajax is very simple method for post a form without page refresh ..

read more about ajax


Are you thinking of AJAX?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜