Javascript as response from ajax call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agam
    New Member
    • Jan 2011
    • 21

    Javascript as response from ajax call

    Here is my ajax call:

    Code:
    	new Request.HTML({
    				url: 'users.html',
    				method: 'get',
    				update: 'go',
    				evalScripts: true, /* !! Why isn't this working!? */
    				onComplete: function(){console.log('ajax complete!')}
    			}).send()
    I even check eval scripts!
    users.html:

    Code:
    <label><h3>Save data here:</h3>
    <br />
    <section id="load" style="display:none;">
    		<img src="progress.gif" />
    	</section>
    <section id="log">
    	</section>
    	<table>
    	<tr><td>Data:</td><td>
    	<textarea id="texta" placeholder="Save here." wrap="off" autofocus></textarea></label>
    	</td></tr>
    	<tr><td>Are you human?</td><td>
    	<div id="cap">
    	<script src="http://api.adscaptcha.com/Get.aspx?CaptchaId=1049&PublicKey=ac589518-4f4e-4566-ae26-c37c0f535a17" type="text/javascript"></script>
    	<noscript><font color="red">Please enable javascript!</font></noscript>
    	</div>
    	</td></tr>
    	<tr><td>&nbsp;</td><td>
    	<input type="button" value="Go" name="submit2" id="start2"/>
    	</td></tr>
    This is not executing:

    <script src="http://api.adscaptcha. com/Get.aspx?Captch aId=1049&Public Key=ac589518-4f4e-4566-ae26-c37c0f535a17" type="text/javascript"></script>
    <noscript><fo nt color="red">Ple ase enable javascript!</font></noscript>

    What is the solution so the script will run?
    Last edited by Dormilich; Mar 30 '11, 11:43 AM.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    is that call meant to be new (Request.HTML(… )); (current) or (new Request).HTML(… ); ? those are different calls.

    Comment

    • agam
      New Member
      • Jan 2011
      • 21

      #3
      I don't know the difference, but does it matter?
      Because I also tried to use the other ajax functions and the script didn't run.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        yes, it does matter. when invoking an object with new, you have to use a constructor function. while I’m pretty certain that Request is a function I’m pretty certain that Request.HTML() (resp. its return value) is not, which makes the call new Request.HTML({… }); fail.

        Comment

        • agam
          New Member
          • Jan 2011
          • 21

          #5
          So how can I implement it?
          (like so?:)
          Code:
          			 Request.HTML({
          				url: 'user.php',
          				method: 'get',
          				evalScripts: true, /* this is the default */
          				update: 'go',
          				onComplete: function(){console.log('ajax complete!')}
          			}).send()
          (it gives me an error.)

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            what library do you use?

            Comment

            • agam
              New Member
              • Jan 2011
              • 21

              #7
              I am using mootools.
              (If you didn't see it before..)

              Comment

              Working...