综合技术

Do not refresh the page on PHP

微信扫一扫,分享到朋友圈

Do not refresh the page on PHP
0

I would like to achieve that when I click on submit button, it doesn’t refresh the page. My submit button only calls set of codes if is submitted. But when it is submitted, it refreshes the page and my variables lose its values.

I know this can be achieved with java-script or ajax but this is where I have no knowledge yet. Need to start learning it. I have tried to use some other suggestion with JavaScript but it didn’t work for me as the JavaScript code was build for most advance form not only one submit button.

My Button:

";

My code which executes when submit button is pressed:

if(isset(&_POST['confirm_points'])) {
    // my code is here
}

Thanks for any help

Here’s a simple example:




    
    
        $(document).ready(function(){
            $('form').submit(function(event){
                event.preventDefault();
                $.ajax({
                    type: $(this).attr('method'),
                    data: $('form').serialize(),
                    success: function(data) {
                        $('#result').html(data);
                    }
                });
            });
        });
    



阅读原文...


微信扫一扫,分享到朋友圈

Do not refresh the page on PHP
0

Hello, buddy!

Insert a registration entity frame

上一篇

Not Just Top Watch Or Smartwatch Maker, Apple Is Now The World’s Top Wearables Company

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Do not refresh the page on PHP

长按储存图像,分享给朋友