[jQuery] Re: $.post send data problem
I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(data){ $(#response).append(data).show('fast'); }); create a div id=response/div try this code and let me know if work. P.S.: My advice is to use firebug for a better debug detail. -- Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay
[jQuery] Re: $.post send data problem
that's exactly what my code does too, only mine replaces the previous data. and I do get a response, it isn't that, I just get no transfer to the $_POST array there is no JS or php error reported by firebug or any other. realtime example: http://l.ängel.se/admin/ what you type in the fields should appear next to the hi (left means $_POST, right means $_REQUEST) On 7 May 2007, at 16:36, Massimiliano Marini wrote: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function (txt) {$(div#+div).html(txt);}); $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(data){ $(#response).append(data).show('fast'); }); create a div id=response/div try this code and let me know if work. P.S.: My advice is to use firebug for a better debug detail. -- Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay
[jQuery] Re: $.post send data problem
but then I'd probably not get any answer at all. I do get an answer, just not one filled with the data I try to send. On 7 May 2007, at 23:55, Equand wrote: maybe it doesn't like this /scripts/login.php? ./scripts/login.php might help... On May 7, 4:36 pm, Massimiliano Marini [EMAIL PROTECTED] wrote: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function (txt) {$(div#+div).html(txt);}); $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(data){ $(#response).append(data).show('fast'); }); create a div id=response/div try this code and let me know if work. P.S.: My advice is to use firebug for a better debug detail. -- Massimiliano Marini -http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay
[jQuery] Re: $.post send data problem
I could be dead wrong here, but when I'm sending a hash like that to my pages (they're CF pages, but I don't *think* that makes a difference) I always put quotes around the name of the argument. Like this: {u:User, p:Pass, r:Stay} I do not, however use quotes if the value I'm passing is a JavaScript variable: {u:ThisUser, p:ThisPass, r:ThisR} I *think* that maybe JavaScript is trying to evaluate u,p and r as variables with values. That's not your intent is it? Hope this helps. Cheers, Chris Tamm Sjödin wrote: but then I'd probably not get any answer at all. I do get an answer, just not one filled with the data I try to send. On 7 May 2007, at 23:55, Equand wrote: maybe it doesn't like this /scripts/login.php? ./scripts/login.php might help... On May 7, 4:36 pm, Massimiliano Marini [EMAIL PROTECTED] wrote: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(data){ $(#response).append(data).show('fast'); }); create a div id=response/div try this code and let me know if work. P.S.: My advice is to use firebug for a better debug detail. -- Massimiliano Marini -http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay -- http://www.cjordan.us
[jQuery] Re: $.post send data problem
this is how I define my string data='{u:'+$('#loginname').val()+',p:'+$('#loginpassword').val() +',r:'+$('#loginremember').val()+'}'; I also tried this data='{u:'+$('#loginname').val()+',p:'+$('#loginpassword').val ()+',r:'+$('#loginremember').val()+'}'; with no change Cheers, Tamm Sjödin On 8 May 2007, at 01:29, Christopher Jordan wrote: I could be dead wrong here, but when I'm sending a hash like that to my pages (they're CF pages, but I don't *think* that makes a difference) I always put quotes around the name of the argument. Like this: {u:User, p:Pass, r:Stay} I do not, however use quotes if the value I'm passing is a JavaScript variable: {u:ThisUser, p:ThisPass, r:ThisR} I *think* that maybe JavaScript is trying to evaluate u,p and r as variables with values. That's not your intent is it? Hope this helps. Cheers, Chris Tamm Sjödin wrote: but then I'd probably not get any answer at all. I do get an answer, just not one filled with the data I try to send. On 7 May 2007, at 23:55, Equand wrote: maybe it doesn't like this /scripts/login.php? ./scripts/login.php might help... On May 7, 4:36 pm, Massimiliano Marini [EMAIL PROTECTED] wrote: I'm sending something like this $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); $.post(/scripts/login.php, {u:USER,p:PASS,r:STAY},function(data){ $(#response).append(data).show('fast'); }); create a div id=response/div try this code and let me know if work. P.S.: My advice is to use firebug for a better debug detail. -- Massimiliano Marini -http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay -- http://www.cjordan.us
[jQuery] Re: $.post send data problem
I found a solution on my own... why didn't I try this before? data='{u:'+$('#loginname').val()+',p:'+$('#loginpassword').val() +',r:'+$('#loginremember').val()+'}'; becomes data='u='+$('#loginname').val()+'p='+$('#loginpassword').val() +'r='+$('#loginremember').val()+''; I'd love some comments on this as a solution, it seems to work but... is it like legit? (it does work now though) Cheers, Tamm Sjödin On 7 May 2007, at 00:30, Tamm wrote: Hi I'm feeling very stupid asking this but here goes: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); but the php $_POST[''] array get's no data... now please tell me how stupid I am :)
[jQuery] Re: $.post send data problem
gee, that kinda like serialize, in jQuery core. serialize() Serializes a set of input elements into a string of data. This will serialize all given elements. A serialization similar to the form submit of a browser is provided by the form plugin. It also takes multiple-selects into account, while this method recognizes only a single option. Returns String On 5/7/07, Tamm Sjödin [EMAIL PROTECTED] wrote: I found a solution on my own... why didn't I try this before? data='{u:'+$('#loginname').val()+',p:'+$('#loginpassword').val()+',r:'+$('#loginremember').val()+'}'; becomes data='u='+$('#loginname').val()+'p='+$('#loginpassword').val()+'r='+$('#loginremember').val()+''; I'd love some comments on this as a solution, it seems to work but... is it like legit? (it does work now though) Cheers, Tamm Sjödin On 7 May 2007, at 00:30, Tamm wrote: Hi I'm feeling very stupid asking this but here goes: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); but the php $_POST[''] array get's no data... now please tell me how stupid I am :) -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: $.post send data problem
maybe try $_REQUEST[''] ??? On May 7, 12:30 am, Tamm [EMAIL PROTECTED] wrote: Hi I'm feeling very stupid asking this but here goes: I'm sending something like this $.post(/scripts/login.php,{u:USER,p:PASS,r:STAY},function(txt) {$(div#+div).html(txt);}); but the php $_POST[''] array get's no data... now please tell me how stupid I am :)