Keyword

Override K2.js ?

  • william white
  • william white's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 11 months ago - 8 years 11 months ago #144274 by william white
Override K2.js ? was created by william white
After searching the forum and J docs and trying various things i have not been able to modify the behavior of components/com_k2/js/k2.js. Is there a way to do this? We are using J3.4.1 and k2 2.6.9

We are trying to redirect the page after the comment has been successfully submitted into the database. Changing the core k2.js file as below it gets our desired result.
// Comments
	$K2('#comment-form').submit(function(event){
		event.preventDefault();
		$K2('#formLog').empty().addClass('formLogLoading');
		$K2.ajax({
			url: $K2('#comment-form').attr('action'),
			type: 'post',
			dataType: 'json',
			data: $K2('#comment-form').serialize(),
			success: function(response){
				$K2('#formLog').removeClass('formLogLoading').html(response.message);
				if(typeof(Recaptcha) != "undefined"){
					Recaptcha.reload();
				}
				if (response.refresh) {
					window.location.reload();
				}
window.location.assign("http://www.oursite.com");
			}
		});
Last edit: 8 years 11 months ago by william white.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #144284 by Krikor Boghossian
Replied by Krikor Boghossian on topic Override K2.js ?
You can unset the k2.js file
www.joomlaworks.net/forum/k2-en/39127-solved-how-to-unset-k2-js-file#136273

Then use Joomla!'s API to load your own version of k2.js docs.joomla.org/JDocument/addScript

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum