$.post gets double xml

Hi,

I want to post to another page, but I get an double xml. one with the variable and one without.

How can I fix this?

Thank you in advance!

$(document).ready(function(){

$("tr").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});

$('.ok').on('click', function(e){
	e.preventDefault();
	var formAction = window.location.href = '/postnltest2';
    alert($("#table tr.selected td:first").html());
    $.post(formAction,
    {
      address: $("#table tr.selected td:first").html(),
    });
    
});

})

Not quite sure I understand what you are doing in your code.

When you set the location.href property, you are instructing the page to immediately access that URL, and then, right after that, you are posting to that same URL ( $.post(formAction,…) ).

I think you’d want to either open the URL, or post to it, but not both.