I have a javascript request like this to pass data to play framework and based on the different propertyKey, the event should have different parameter.
I do something like this.
The js is used by multiple windows. So this._propertyKey will change based on different windows.
_postEvent: function(customData) {
 var propertyKey = this._propertyKey;
 var Event = {
       propertyKey : customData
     },
     url = play.url({
       alias: 'controllers.eventController.trackEvent',
       args: Event,
       withCsrf: true
     });
 return $.ajax(url, {
   type: 'POST'
 });
},
The problem when I trigger this code. According to the request it sends, it is always Event.propertyKey instead of the customized propertyKey I pass in. For example, if for this window, propertyKey = 'region'. I want 'region' to pass in as the parameter. But no matter what propertyKey is, the post request always sends Event.propertyKey = XXX instead of Event.region = XXX.
Is there a way to pass in the propertyKey here Is use to make it change dynamically based on different pages?
 
     
    