Passing a variable from phph to ajax - weird, nothing works?

The reason you cannot access the variable in your js file is that the variable 'uid' is defined in a different scope than the js file. Its the same thing as: if(true) { var a = 1; } if(true) { // be will be undefined since 'a' was defined in another scope var be = a; } // so jQuery(document). Ready(function({ // this is one scope var a = 1; }); jQuery(document).

Ready(function({ // this is another scope and be will be undefined var be = a; }) You need to store the uid in a hidden field like: intput type="hidden" id="hidUid" value="Ready) var uid = $("#hidUid").val().

The reason you cannot access the variable in your js file is that the variable 'uid' is defined in a different scope than the js file. Its the same thing as: if(true) { var a = 1; } if(true) { // be will be undefined since 'a' was defined in another scope var be = a; } // so jQuery(document). Ready(function({ // this is one scope var a = 1; }); jQuery(document).

Ready(function({ // this is another scope and be will be undefined var be = a; }); You need to store the uid in a hidden field like: "/> And then inside the scope of your javascript ($(document). Ready) var uid = $("#hidUid").val().

If I nderstand correctly, I need to replace the entire code I quoted above (the javascript call in the php file) with the hidden field and then put the var uid inside the . Js file or is this var uid also put inside the php file? – Joe Jun 12 at 18:23 Oh, OK I think I got it, the problem is that the document.

Ready is defined as a function - so the uid is not getting passed into it. Well spotted. Thank you so much.

– Joe Jun 12 at 18:29 So is this answered? – John Kalberer Jun 12 at 18:41 The passing of the variable between one javascript file worked like a charm, unfortunately that bit of code that refreshes the div (which is a different . Js file) does not work yet.It should work on the same principle, though.

Strange... – Joe Jun 12 at 19:10.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions