+ 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/#
3 odpowiedzi
+ 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...
+ 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">
+ 5
i think that this is not allowed by SL rules