Here's a question from a beginner: what if I create a function named sendRequest that accepts multiple parameters for an ajax call?
I'm not really concerned about the ajax request itself, I just want to understand how the parameters work.
function sendRequest($el, url, trackingUrl, actionTypeString) {
$.ajax({
method: 'POST',
url: url,
actionTrackingUrl: trackingUrl,
actionType: actionTypeString,
el: $el,
})
}
function testCase1() {
// ......... code
this.sendRequest($someEl, url, someTrackingUrl, someActionTypeString)
}
function testCase2() {
// .......code
this.sendRequest($someEl, someUrl, someActionTypeString);
}
In testCase2, how can I provide the 4th parameter (actionTypeString) without providing the 3rd parameter?