I am trying to replace a certain value inside a HTML parseado
, using the following function I can replace values that are inside tags inputs, css and etc:
$('input[value="/services/CouponTemplate.mvc/GetCoupon"]').attr('value', function(_, href){
return "https://meusite.com?url=https://siteremoto.com" + href;
});
But now I need to replace an address that is inside the <script type="text/javascript">
tag.
Here's how:
<script type="text/javascript">var inPlayPreferences={"MarketOrder":,"InPlayAppServiceName":"/services/InPlayApp.mvc/"};</script>
I need to replace /services/InPlayApp.mvc/
, I get through PHP with str_replace
, but I would like to know if I can do the same using jQuery.
I tried to repeat the procedure by changing input
by script
but it did not work, I am a beginner in Javascript world.
Is there anything similar to str_replace
of PHP in jQuery?