Jump to content

Reload Module Tab Contents With Ajax


Blesta Addons

Recommended Posts

i want to reload the tab contents of my module with ajax , but is not working .

i have added the class "ajax" to my link , no result .

let say i have tabStats , i want to add a button inside this tab , when clicked the content of this tab reloaded via ajax .

any tips to achieve this ?

 

EDIT :

ihave arrived to some result , but till something is not working . now i can send the update post via this javascript . but the content is not updated , i s in the dev tools the request is loading the new data .

$(".refresh").click(function() {
 
  var a = $(this);
  $(this).blestaRequest("GET", $(this).attr("href"), null, function(data) {},
  null,
  {dataType:"json"});
 
  return false; 
 
});
Link to comment
Share on other sites

Would just create a big <div> of your own inside your tab.

<div id="mycontent">initial content [...]</div>

and change that using Ajax with something along the lines of:

$.post(document.location.href, {'somepostparameter': 'value'}, function(reply) {
   document.getElementById("mycontent").innerHtml = reply;
}, 'html');

(not tested)

Having the <div> of your own, prevents you from having to make assumptions about the Blesta template that includes the tabs. It may change in the future, or it may have been modified by the user if you develop for others.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...