1

I have a litte problem.

I call an file and this file has to know from which level it was called. I'm developing in an special tool, and thats how it works here.

for example:

var Url = baseUrl + "?func=ll&objId=" + WebreportId + "&objAction=RunReport";
          
jQuery.ajax({
  url: Url,
  type: "GET",
  data: { level: 'dossier' },            
  success: function(response){

    $('#thirdPartyContent').html($(response).find('#cvDossier').html());                                    
  }
});

In my JavaScript Functions in the Call, i have to know from which level it was called. Like here "dossier".

How can i read out an string in the call? With the URL Parms i can just check the superior url, and not the url from the ajax call, isn't it?

I hope you understand my probs.

isherwood
  • 58,414
  • 16
  • 114
  • 157
Thandor
  • 25
  • 8

1 Answers1

0

Try utilizing beforeSend option of $.ajax()

jQuery.ajax({
  url: Url,
  type: "GET",
  data: { level: 'dossier' },  
  beforeSend: function(jqxhr, settings) {
    // set `data` property at `jqxhr` object 
    jqxhr.data = settings.url..match(/=.*/)[0].split(/=|&.*/).filter(Boolean)[0];
  },                                    
  success: function(response, textStatus, jqxhr){   
    // do stuff with `jqxhr.data` : `"dossier"` 
    console.log(jqxhr.data);
    $('#thirdPartyContent')
    .html($(response).find('#cvDossier').html());                                                                                                                                               
  }
});
guest271314
  • 1
  • 15
  • 104
  • 177