我想要實現Ajax/J-Query更新數據庫,現在我需要重新加載我的ctp頁面的所有內容在cakephp沒有刷新/重定向。如何重新加載控制器沒有重定向/刷新cakephp
可能嗎?
請幫我一把。
我試圖
$.ajax({
url: 'http://localhost/projectname/Experiences/experienceadd',
type: 'POST',
data: {'companyname':companyname,'title':title,'monthstart':monthstart,'location':location,'yearstart':yearstart,'yearnextstart':yearnextstart,'monthnextstart':monthnextstart,'presentyeardata':presentyeardata,'description':description},
success: function (data) {
if(data)
{
mystr = '<div style="display: block; opacity: 1;" class="item mix book mix_all" data-year="2010"> <div class="pubmain"> <div class="pubassets"> <a href="#" class="pubcollapse"> <i class="icon-expand-alt"></i> </a> </div> <h4 class="pubtitle"> ' + companyname + '</h4> <div class="pubauthor"><strong>'+ title +'</strong>,'+ location+'</div> <div class="pubcite">'+ yearstart +' - '+ yearnextstart +' , <strong>'+ presentyeardata + '</strong> </div> </div> <div style="display: none;" class="pubdetails"> <h4>'+ description+'</h4> <div class="pubdetails"> <a class="icon_a icon_right_head" class="exp_rid" id="'+ data +'" href="javascript: void(0);"><i class="icon-trash"></i> Remove</a> <a class="icon_a icon_right_head" class="exp_eid" id="'+ data +'" href="javascript: void(0);"><i class="icon-pencil"></i> Edit</a> </div> </div></div>';
$('#pexperience_details').append(mystr);
$("#experience-box").hide(500, function() { });
$('#add-experience').show();
$().toastmessage('showSuccessToast','your skill is successfully Saved');
}
else
{
$().toastmessage('showErrorToast', 'your skill is not successfully Saved');
}
}
});
但是這一次只添加一個內容區域。如果我的問題解決了,則不需要上述代碼。 任何想法.....?
謝謝
是的,它是可能的。但告訴我們你試過的東西 – 2014-12-19 09:25:01
我試過以上的東西。 – Yash 2014-12-19 09:28:36