Jump to content

How do I reference a part of my URL in my code?


izlude

Recommended Posts

Hi again. Today's question is: how do I reference a part of my url from jQuery? We're only looking at this ajax code, although it isn't done (or correct?), I'm mainly looking at the part that says +EcardText+. This worked when my project was in Flash, however I don't know if it's still valid in JS or HTML5. This is an Adobe Animate Canvas project. So, is this the right way to use it for JS or do  need to change a few things?

            		   $.ajax({
		     url : 'http://www.MYSITE.net/texts/'+EcardText+'.php',
		     data: data,
		     type : 'POST',
		     success : function (result) {
		  console.log (result); // Here, you need to use response by PHP file.
          this.ToName.text = 'test';
            },
		     error : function () {
		        console.log ('error');
		     }
		   });

 

Additional info:

Quick explanation of the site's functions. My main php gets values from text input fields, puts them into randomly numbered php files so that the e-card can load them with the above code. Example, 1584664937.php... and then a preview link is also generated that looks like this:

http://www.MYSITE.net/texts/SelectCard.php?EcardText=1584664937&ENum=0

 

SelectCard.php used to embed flash movies (e-card animations) with the below code, however instead of embedding swfs, i embed the html as follows:

case '0':
$goto = "ecards/birthdaycards/birthday1.html?EcardText=".$EcardText;
$Dimensions = "WIDTH=510 HEIGHT=580";
break;

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
	<? print "$Dimensions";?>>
		<PARAM NAME=movie VALUE="<? print "$goto";?>">  
			<EMBED src="<? print "$goto";?>" <? print "$Dimensions";?> </EMBED>
</OBJECT>

The ajax code at the very top is located in "birthday1.html", so I'm not sure if there's a conflict where the birthday html has to "look outside (if that makes sense?) to get the EcardText number in the url..? I'll draw a picture, I'm really bad at this... but highly highly appreciate any help!!! Thanks guys!!!

https://imgur.com/a/65lPKd2

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...