【发布时间】:2015-07-29 10:56:48
【问题描述】:
我无法重新初始化某些代码。
我有一个插件的功能,我需要在点击时重新初始化。我上个月开始学习 JS 和 PHP,所以我仍然对操作我没有编写的代码感到不舒服。
这是我需要重新加载的代码,在 PHP 文件中找到:
/** $return FFGeneralSettings */
public function getGeneralSettings(){
return $this->generalSettings;
}
public function register_shortcodes()
{
add_shortcode('ff', array($this, 'renderShortCode'));
}
public function renderShortCode($attr, $text=null) {
if ($this->prepareProcess()) {
$stream = $this->generalSettings->getStreamById($attr['id']);
if (isset($stream)) {
$settings = new FFStreamSettings($stream);
if ($settings->isPossibleToShow()){
/*ob_start();
include(AS_PLUGIN_DIR . 'views/public.php');
$file_content = ob_get_clean();
echo $file_content;*/
ob_start();
include(AS_PLUGIN_DIR . 'views/public.php');
$output = ob_get_contents();
ob_get_clean();
return $output;
}
}
}
}
我想我会使用 Javascript 重新初始化上述代码中的操作吗?我在下面制作的这个骨架是否走在正确的轨道上?
$(document).ready(function(){
$('a').on('click',function(){
//does the magic happen in here?
});
});
感谢您的建议,到目前为止,我从你们那里学到了很多东西! 哦,另外,如果答案在 jQuery 中,我很好。
【问题讨论】:
-
你可以试试ajax ....
标签: javascript php jquery plugins wordpress