I am making a plugin that creates a tab with a link that exectutes a php file using AJAX. However, it will not execute the php file when clicking on the link. I have tried for 20 hours to get it working but somehow it just wont execute. Is cb blocking ajax in tabs? Am I missing something? Im soon going crazy.
The query is also just a placeholder to see that its working, it is executing when I open the php file manually. I really need to get this working.
Thanks in advance,
LnG
I just solved it with another code, still dont know what was wrong with the first one though.
A moderator can close or delete this thread, thanks.
Code:
<script>$(function(){
// Bind a click event to your anchor with id `updateSal`
$("#updateSal").click(function(){
// get your employeeID
var empID = "32";
// issue an AJAX request with HTTP post to your server side page.
//Here I used an aspx page in which the update login is written
$.post("'.JURI::base().'path/to/file/file.php", { EmpID: empID},
function(data){
// callack function gets executed
alert("Return data" + data);
});
// to prevent the default action
return false;
});
});</script>
CB does not block ajax calls. We can not advise you on custom coding, sorry. The correct way to utilize jQuery is to load it through Joomla or CB API. Echoing a script does not correctly prepare your jQuery, especially for noConflict usage. To output jQuery with CB you'd supply your JS string to the below function (excluding the script HTML).
Code:
$_CB_framework->outputCbJQuery( $js );
The above handles the noConflict, namespace, document ready, and loading of jQuery automatically.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.