php - Change action and image src url's with jQuery -
i parsing form 1 of sites using php proxy. working fine form action , img src of submit button url's relative. how can prepend full http//www.domain.com/ in front of each of url's in form?
edit:
here's form code once fed through new domain:
<div style="display: none;" id="subscribeform" class="newform"> <h5>subscribe our newsletter</h5> <form action="/campaignprocess.aspx?listid=27057" method="post" onsubmit="return checkwholeform93426(this)" name="catemaillistform93426"> <div class="form"> <div class="item"> <label for="clfullname">full name</label> <br /> <input type="text" maxlength="255" id="clfullname" name="fullname" class="cat_textbox_small" style="background-color: #ffffa0;" /> </div> <div class="item"> <label for="clemailaddress">email address</label> <br /> <input type="text" maxlength="255" id="clemailaddress" name="emailaddress" class="cat_textbox_small" style="background-color: #ffffa0;" /> </div> <div class="item"> <label>enter word verification in box below</label> <br /> <div class="captchaimg"><img src="/captchahandler.ashx?id=22791bf65054422cadeb4aea9390cfaa&color=dimgray&forecolor=white&width=160" alt="captcha image" /></div> <input id="captchav2" class="cat_textbox" type="text" name="captchav2" style="width:160px" /> <input id="captchatv2" type="text" name="captchatv2" style="display:none;" /> <input id="captchahv2" type="hidden" value="22791bf65054422cadeb4aea9390cfaa" name="captchahv2" /> </div> <div class="item"> <p>we respect privacy , never share details.</p> </div> <div class="item"> <input type="image" src="/images/submit-button-white-bg_07.gif" id="catlistbutton" value="subscribe" class="cat_button" /> </div> </div> <script type="text/javascript" src="http://testsite.businesscatalyst.com/catalystscripts/validationfunctions.js"></script> <script type="text/javascript">function checkwholeform50598(theform){var why = "";if (theform.emailaddress) why += checkemail(theform.emailaddress.value);if (theform.captchav2) why += isempty(theform.captchav2.value, "enter word verification in box below"); if (why != ""){alert(why);return false;}theform.submit();return false;}</script> </form> </div>
and here's jquery using try , change action url:
jquery(document).ready(function($) { $('form').each(function(index) { var urls = $(this).attr('action'); var dom = 'http://www.sampleurl.com'; $(this).attr('action',dom+urls); }); });
all other jquery functions working on page know not issue jquery itself.
well start of reading original url
$('img').each(function(index) { var urls =$(this).attr('src'); var dom = 'http://domain.com'; $(this).attr('src',dom+urls); });
that change image urls might way works good
checkout here
Comments
Post a Comment