2017-02-14 102 views
-2

我需要一個幫助。我需要在使用PHP提交表單後重新加載頁面。我在下面解釋我的代碼。使用PHP和Javascript提交表單後重新載入頁面

$insert = $this->modl_obj->db_insert('db_newsletter',$values, $columns); 
    if($insert !=false){ 
     $GLOBALS['msg']='1'; 
} 

function messagestatus(st){ 
     switch(st) 
     { 
      case 1: 
      { 
       alert("Inserted Successfully."); 
       break; 
      } 
     } 
    } 
    messagestatus(<?php echo $GLOBALS['msg'] ?>); 

在這裏,我需要重新加載警告消息後的頁面。這種形式出現在以下鏈接的許多頁面中。

http://localhost/takeme 
http://localhost/takeme/about 

請幫我解決這個問題。

+0

使用位置.reload();'。在提醒後寫下來。 –

回答

0

這將刷新你的頁面中使用它在任何你需要

case 1: 
     { 
      alert("Inserted Successfully."); 
      location.reload(); 
      break; 
     } 
+0

@ Mudassar Saiyed:我做到了,但無法重新加載。因爲當我刷新頁面時,警報提示即將到來。 – subhra

+0

試試這個......我編輯了答案 –

0

這裏有535 ways to reload a page using javascript,非常酷:

這裏是前20:

location = location 
location = location.href 
location = window.location 
location = self.location 
location = window.location.href 
location = self.location.href 
location = location['href'] 
location = window['location'] 
location = window['location'].href 
location = window['location']['href'] 
location = window.location['href'] 
location = self['location'] 
location = self['location'].href 
location = self['location']['href'] 
location = self.location['href'] 
location.assign(location) 
location.replace(location) 
window.location.assign(location) 
window.location.replace(location) 
self.location.assign(location) 

最後10 :

self['location']['replace'](self.location['href']) 
location.reload() 
location['reload']() 
window.location.reload() 
window['location'].reload() 
window.location['reload']() 
window['location']['reload']() 
self.location.reload() 
self['location'].reload() 
self.location['reload']() 
self['location']['reload']() 
相關問題