0

I'm getting the response from my third party like the below

https://app-pv.myfamily.com/myconnect/myapp/myDetails?myDetailsNbr=U123763673&source=myAppsearch&error=[[Error%20in%20object%20%27myStatusModel%27:%20codes%20[claims.correct.adjust.notsubmitted.27myStatusModel,myApp.correct.adjust.notsubmitted];%20arguments%20[];%20default%20message%20[This%20Claim%20has%20an%20Corrected%20Claims%20which%20is%20not%20yet%20approved.]]]

I have to parse the default message array in the url link at the end %20default%20message%20[This%20Claim%20has%20an%20Corrected%20Claims%20which%20is%20not%20yet%20approved.]

and show the error msg inside it.I've used split method but I can get only the url its not giving the last array. I've tried to remove the %20 using replace but I'm unable to get the default message array.

 var str = "https://app-pv.myfamily.com/myconnect/myapp/myDetails?myDetailsNbr=U123763673&source=myAppsearch&error=[[Error%20in%20object%20%27myStatusModel%27:%20codes%20[claims.correct.adjust.notsubmitted.27myStatusModel,myApp.correct.adjust.notsubmitted];%20arguments%20[];%20default%20message%20[This%20Claim%20has%20an%20Corrected%20Claims%20which%20is%20not%20yet%20approved.]]]";
  var url = str.replace(/%20/g, "");
  console.log(url.find,'ppp')
Hema Nandagopal
  • 668
  • 12
  • 35
  • 1
    The question is unclear. The url does not contain any json. Yet, you can use [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) to get the error text. – Yogi Nov 29 '22 at 08:51
  • Sorry, I've updated the question. @Yogi, can you please re-open it? – Hema Nandagopal Nov 29 '22 at 08:56
  • Does this answer your question? [How can I get query string values in JavaScript?](https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript) – Heretic Monkey Nov 30 '22 at 02:10

0 Answers0