Do not refresh the page on PHP

综合技术 2017-11-15 阅读原文

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:

                    type: $(this).attr('method'),
                    data: $('form').serialize(),
                    success: function(data) {

Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!


Combining and compressing multiple JavaScript file... I am working on a PHP app that requires eight javascript files (hello web2.0). I am wondering what the best way com...
PHP: Why is the browser output at the to... I'm grabbing a number from a form on an html file, the current goal now is to simply output the range of numbers. But, t...
Announcing Choo v6 Heya :wave:, today we’re releasing choo v6.0.0 . After 5 release candidates, we're happy to finally share it with the w...
Useful Javascript Array and Object Methods I listened to a great Syntax FM podcast that summarized useful JavaScript array and object methods. These methods...
js排序算法详解-计数排序 全栈工程师开发手册 (作者:栾鹏) js系列教程5-数据结构和算法全解 js排序算法详解-计数排序 计数排序就是遍历数组记录数组下的元素出现过多次,然后把这个元素找个位置先安置下来,简单点说就是以原数组每个元素的值作为新数组...