2

I have form and submit button like this :

<a href="javascript:void(0)" id="submit" class="easyui-linkbutton" onclick="$('#form_po_customer2').submit();">Save</a>

I need refresh page like this button, after submit button :

<a href="javascript:void(0)" id="order_customer2" class="easyui-linkbutton" onclick="$('#form_po_customer2').form('clear')">Reset</a>

And function js order_customer2 like this :

$("#order_customer2").live('click',function(){
$('#tabhome').tabs('select', 'Konten');
$('#konten_menu').html('<div  align="center"></div><img  src="images/loader.gif" /></div>').fadeIn();
$('#konten_menu').load('data/tr_po_customer2.php');})

And function js for submit form :

$('#form_po_customer2').form({  
        url:'process/fse_po_customer2.php',  
        onSubmit:function(){  

        },
        success: function(result){
                        var result = eval('('+result+')');
                        if (result.success){
                            $.messager.show({
                                title: 'Success',
                                msg: result.msg
                            });
                                            $('#tt').datagrid('reload');
                                            $('#tt3').datagrid('reload');
                                            $('#form_po_customer2').form('clear');
                        } else {
                            $.messager.show({
                                title: 'Error',
                                msg: result.msg
                            });
                        }
                    }    
    }); 

I need for refresh page for generate new session. How to refresh page after submit form? Like call functions id=order_customer2 (attribute element)

deib97
  • 35
  • 9

1 Answers1

0

The only way to get a new session is by NOT having the form submit via AJAX, and having it submit via form method="POST" and action="process/fse_po_customer2.php"

Otherwise you would need to do session_destroy() in fse_po_customer2.php and then once AJAX is successful, reload the page which should generate the new session.

Kanad Godse
  • 309
  • 1
  • 6
  • Hmm, but i'm not move page. In my js OnSubmit, i write : $('#form_po_customer2').form('clear'); If any ajax to refresh page, where i put ajax in submit after success?? – deib97 Jun 17 '16 at 07:01
  • Yes, why don't you try writing `$('#form_po_customer2').form('clear');` inside `onSubmit:function(){ }` – Kanad Godse Jun 17 '16 at 07:07
  • That means even if you have a reset button as you mentioned in your original question, you would still have the same problem! I think you should check your HTML code. There could be issues with it. Check if #form_po_customer2 is correct, check by actually adding a reset button and using it, check by calling `$('#form_po_customer2').form('clear');` from browser console / chrome developer tools (F12). – Kanad Godse Jun 17 '16 at 07:15
  • What exactly do you mean by "broken view"? You will need to either give details or start a new question. But first, is the form clear method resetting the form? are your from elements getting reset? If so, then you have found your answer! Next comes the question of broken view. – Kanad Godse Jun 17 '16 at 09:08