Jump to content
Sign in to follow this  
izlude

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

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

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...