problem with post()

problem with post()

Hi everyone,

I am trying to write a javascript to login to SMS gateway (HTTPS) and send SMS through it. Login is OK, but when I try to send message, it tells me that page expired. When I do it by myself in browser, its OK - I clasically post data by https://www.park.vodafone.cz/gateway?x=...&number=...&text=... and it works. But in my script, it doesnt. Here it is:

  1. jQuery.post("https://park.vodafone.cz/login", { email: EMAIL, password: PASSWORD },
  2.       function(){
  3.         jQuery.get("https://park.vodafone.cz/gateway",
  4.           function(data){
  5.             re = /name="sendButton"[^>]+?'\?x=(.+?)',/;
  6.             match = re.exec(data);
  7.             TOKEN = match[1];
  8.             jQuery.post("https://park.vodafone.cz/gateway", { x: TOKEN, "recipients:recipientInput": NUMBER, text: MESSAGE } );
  9.           }
  10.         );
  11.       }
  12. );
The part on line 9 doesn't work, but I don't know why, TOKEN is matched correctly.

Please, if anybody have some idea, I would really appreciate that.