如何使用jquery或javascript重新加载页面而不刷新

时间:2016-01-17 18:47:25

标签: javascript php jquery ajax

是否有可能在没有刷新的情况下获取页面我正在使用菜单选项卡但每次点击链接时加载但我有一个参数我需要在重新加载页面时也能通过我怎么办才有可能在jquery或javascript如果是这样的话?

    echo '<h2 class="nav-tab-wrapper">';
    for($i=1; $i<=$camps; $i++) { //class="nav-tab nav-tab-active"

        if($i==$c_tab) $class = 'class="nav-tab nav-tab-active "';
        else $class = 'class="nav-tab"';
 echo '<script src="https://code.jquery.com/jquery-1.10.2.js"></script>';

     $url = plugins_url().'/CPA-R61';

        echo '<a  href="?page=CPA-R6&tab='.$i . '" ' . $class . '" id="titleee">Campaign ' . $i . '</a>';
    }  
    echo '<h2>';

    echo '<div id="content">';
    echo  '<tr><th scope="row">Campaign';

     if($_GET["tab"])
     {
    echo  $_GET["tab"];
     }
     else
     {
        echo  1; 
     }

    echo 'Active:</th><td>
                  <input type="radio" name="active" value=1 ' . $yes . '  />
                    Yes                                    
                  <input type="radio" name="active" value=0 ' . $no . ' />
                    No</td></tr>';

    $args = array(
    'post_type' => 'page',
    'name' => 'cpar6page',
    'show_option_none' => 'No Page',
    'post_status' => 'publish',
    'selected' => get_option('wpbh_cpar6page'.$c_tab),
    ); 

    echo '<tr><th scope="row">Choose a Page </th><td>';
    wp_dropdown_pages( $args );
    echo 'Send traffic to: ' . '<a href="'. get_permalink( get_option('wpbh_cpar6page'.$c_tab) ) . '">' .  get_permalink( get_option('wpbh_cpar6page'.$c_tab) ) . '</a>';
    echo '</td></tr>';

    echo '<tr><th scope="row">1. Redirect Traffic to Which URL(s):</th><td>';
    echo '<input name="redirect1" type="text" value="' . get_option('wpbh_cpar6redirect1'.$c_tab) . '" size="80" />';
    echo '&nbsp;&nbsp;&nbsp;Countries:';
    echo '<input name="countries1" type="text" value="' . get_option('wpbh_cpar6countries1'.$c_tab) . '" size="40" /> (eg: US, GB, all)<br></td>';
    echo '</tr>';

        echo '<tr><th scope="row">2. Redirect Traffic to Which URL(s):</th><td>';
    echo '<input name="redirect2" type="text" value="' . get_option('wpbh_cpar6redirect2'.$c_tab) . '" size="80" />';
    echo '&nbsp;&nbsp;&nbsp;Countries:';
    echo '<input name="countries2" type="text" value="' . get_option('wpbh_cpar6countries2'.$c_tab) . '" size="40" /> (eg: FR, GR, rest)<br></td>';
    echo '</tr>';

        echo '<tr><th scope="row">3. Redirect Traffic to Which URL(s):</th><td>';
    echo '<input name="redirect3" type="text" value="' . get_option('wpbh_cpar6redirect3'.$c_tab) . '" size="80" />';
    echo '&nbsp;&nbsp;&nbsp;Countries:';
    echo '<input name="countries3" type="text" value="' . get_option('wpbh_cpar6countries3'.$c_tab) . '" size="40" /> (eg: IR, ZI, rest)<br></td>';
    echo '</tr>';

        echo '<tr><th scope="row">4. Redirect Traffic to Which URL(s):</th><td>';
    echo '<input name="redirect4" type="text" value="' . get_option('wpbh_cpar6redirect4'.$c_tab) . '" size="80" />';
    echo '&nbsp;&nbsp;&nbsp;Countries:';
    echo '<input name="countries4" type="text" value="' . get_option('wpbh_cpar6countries4'.$c_tab) . '" size="40" /> (eg: TS, HJ, rest)<br></td>';
    echo '</tr>';


    echo '<tr><th scope="row"><b>Choose which Pages to act as Referers</b></th></tr>';

    echo  '<tr><th scope="row">Allow Homepage:</th><td>
                  <input type="radio" name="hp" value=1 ' . $yeshp . '  />
                    Yes                                    
                  <input type="radio" name="hp" value=0 ' . $nohp . ' />
                    No</td></tr>';




    echo '<tr><th scope="row">Allowed Posts:</th><td>';
    echo '<input name="pps" type="text" value="' . get_option('wpbh_cpar6pps'.$c_tab) . '" size="40" /> (comma seperated, eg: 1, 4, 10, all)<br></td>';
    echo '</td></tr>';



    echo '<tr><th scope="row">Allowed Categories of Posts:</th><td>';
    echo '<input name="cposts" type="text" value="' . get_option('wpbh_cpar6cposts'.$c_tab) . '" size="40" /> (comma seperated, eg: 1, 4, 10)<br></td>';
    echo '</td></tr>';





    echo '<tr><th scope="row">Allowed Tags:</th><td>';
    echo '<input name="atags" type="text" value="' . get_option('wpbh_cpar6atags'.$c_tab) . '" size="40" /> (comma seperated, eg: 2, 3, all, none)<br></td>';
    echo '</td></tr>';

    echo '<tr><th scope="row">Allowed Categories:</th><td>';
    echo '<input name="acats" type="text" value="' . get_option('wpbh_cpar6acats'.$c_tab) . '" size="40" /> (comma seperated, eg: 2, 3, all, none)<br></td>';
    echo '</td></tr>';

    echo '<tr><th scope="row">Preferred Posts:</th><td>';
    echo '<input name="cpar6pposts" type="text" value="' . get_option('wpbh_cpar6pposts'.$c_tab) . '" size="40" /> (comma seperated, eg: 0, 12, 22, 32)<br></td>';
    echo '</td></tr>';


    echo ' </table><br><br>';



    echo '<tr><td></td></tr>';

    echo '<input type="hidden" name="update" value="yes" />';

    echo '<input type="hidden" name="tab" value='. $c_tab .' />';

    echo '<input type="submit" value="Save Settings" style="height: 5.5em; width: 10em" />';

echo '</div>';

1 个答案:

答案 0 :(得分:1)

您可以使用location.reload函数

document.location.reload(true);

Location.reload()方法从当前网址重新加载资源

更多文档here