I have an example textarea markup as follows
<textarea>
<module name="TOP_FA" COUNT="5" ></module>
<module name="TOP_FA" COUNT="5" POSITION="QB" ></module>
<module name="TOP_FA" COUNT="5" POSITION="RB" ></module>
<module name="TOP_FA" COUNT="5" POSITION="WR" ></module>
<module name="TOP_FA" COUNT="5" POSITION="TE" ></module>
<module name="TOP_FA" COUNT="5" POSITION="PK" ></module>
<module name="TOP_FA" COUNT="5" POSITION="Def" ></module>
</textarea>
I am trying to ajax that page with the textarea , then add an attr to each module and post in on another page. I assumed it to be easy and thought this would work. Any ideas ? When i post ajax back the url paremeter is not being added.
$.ajax({
url: 'https://www48.myfantasyleague.com/2022/csetup?L=43570&C=HMPGMSG&SEQNO=34',
xhrFields: {
withCredentials: true
},
cache: false,
type: "GET",
dataType: 'html',
success: function (data) {
var tmpElement = $('<div>' + $(data).find('textarea').val() + '</div>');
$(tmpElement).each(function (index) {
$(this).find("module").attr('YEAR', '2021')
});
$.ajax({
url: baseURLDynamic + "/" + year + "/message?LEAGUE_ID=" + league_id + "&NAME=message34",
xhrFields: {
withCredentials: true
},
data: tmpElement,
beforeSend: function (jqXHR, settings) {
console.log(settings.url);
},
cache: false,
type: "POST",
success: function (response) {
console.log("SUCCESS");
},
error: function (xhr) {}
});
},
error: function (xhr) {}
});