+ 27

How to get the source code of a SoloLearn code from the playground into a JavaScript variable?

I am trying to write a script that shows 2 codes from the SoloLearn playground on the same web page. To do that I would have to get the source code into a JavaScript variable. What is the URL to get the source code from a code from SoloLearn? If I put in the URL to a code, I get the whole code page, but I only want to have the actual source code without anything else.... The Language Comparison script can be found here... https://code.sololearn.com/WfpY4zqBx9yk/#

1st May 2018, 6:37 AM
Modi
Modi - avatar
3 Answers
+ 22
I figured it out... codePageOnSoloLearn is the URL... $.get( codePageOnSoloLearn, function( response ) { var sourceCode = $( response ).find("input.saveSourceCode").attr( "value" ); $("#topCode").text( sourceCode ) }); Now I just have to figure out why the syntax highlighting does not work anymore...
1st May 2018, 12:09 PM
Modi
Modi - avatar
+ 11
To get your codes url,press share and youll see its link. Your solution might two iframe tags <iframe src="code1link" > <iframe src="code2link">
1st May 2018, 8:12 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 5
i think that this is not allowed by SL rules
1st May 2018, 7:50 AM
KrOW
KrOW - avatar