Currently, I am using Greasemonkey in Firefox to modify the content displayed on a specific website. On this site, there is a dropdown menu with two options - let's refer to them as element0 and element1. Whenever a user switches between these elements, an ajax query is triggered which updates the page content accordingly. Here is a snippet of the code:
$(".dropdown").change(function(){
if($(this).val()=='element0'){
$.ajax({
// retrieve specific html
});
}
else{
$.ajax({
// retrieve different html content
});
I am satisfied with how element0 functions, but I would like to make changes to the content associated with element1. However, I am unsure about how to trigger my own userscript function only when the second case occurs. Additionally, it should only execute after the ajax query has been completed. Can anyone provide guidance on how to accomplish this?
While I do have some programming experience, I lack knowledge in areas such as jQuery, ajax, and json. A friend assisted me in identifying the above ajax code so that I could ask a meaningful question here. Please consider my level of expertise when providing advice, as I am eager to learn and progress with your help.
Thank you in advance!
EDIT: The javascript mentioned above is being executed by the host. I accessed it by saving the page and examining it manually. My goal is to create userscripts on the client side to adjust the content displayed in my browser according to their javascript functions.