Jump to content

Ajax


EmptyMind

Recommended Posts

Hey Guys, quick question. 

 

For module 'manage' tabs, we are running into 2 issues hopefully you can point us in the right direction. 

 

1) CSS, Since the tab switching is done via an ajax 'replacer' call, there is no way to 'inject' the css into the header of the page in the tab function. Where would be the 'right place' to load up the css for the module? (Doing it all inline really sucks).

 

2) AJAX.. is there a place or method of calling that we can use to properly call ajax, so that our functions can still access 'blesta' but so that blesta will just allow the code to run, and output the json back to the javascript without messing about with it. Kinda like the 'tab switching'.

 

James

Link to comment
Share on other sites

Here's an example of each:

 

<script type="text/javascript">
$(document).ready(function() {
        // Load CSS (taken from SolusVM module)
	$(this).blestaSetHeadTag("link", {media:"screen", type:"text/css", rel:"stylesheet", href: "<?php echo $this->Html->safe($this->view_dir . "css/styles.css");?>"});

        // AJAX request (taken from admin_packages_add template
        $(document).blestaRequest('POST', '<?php echo $this->Html->safe($this->base_uri . "packages/moduleoptions/");?>', $('#module_id').closest('form').serialize() + meta_values,
		function(data) {
			if (data) {
				$('#module_options').html('');
				$('#module_email_tags').html('');
				$('#module_options').html(data.module_options);
				$('#module_email_tags').html(data.module_email_tags);
			}
		},
		null,
		{dataType:'json'}
	);
});
</script>
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...