While using Angularjs v0.9 and php to implement my membership system
In this following function, I will call an api to edit the data of the member, on success, the php function will return
{"success":"true"}
and the controller will return to a page that can view the member of the data.
if(response.success==="true") {
window.location="#/register_members";
$('.alert-error').hide();
$('.alert-success').html("Member is updated.");
$('.alert-success').fadeIn();
}
However, at #/register_members, the data still remains as the unchanged data. Is there anyway I can refresh the page partially in angularjs? I am using ng:view and $route.
I have tried using
window.location.reload(true);
but the success message will not be rendered as the whole page is renewed.
Does anyone have any idea?
Found an interesting answer here to refresh a div in the page using Jquery
my page is "#/register_members" the div i want to update is "#registerlist" which is inside a div called "#browse-box".
so now my controller will be
window.location="#/register_members";
$("#browse-box").load("/#/register_members #registerlist")
$('.alert-error').hide();
$('.alert-success').html("Member is updated.");
$('.alert-success').fadeIn();
works like a charm. :)