Jump to content

Call procedure from added script


Recommended Posts

Hi

 

I'm trying to hook up my app to a joomla site/database. In a script (compiled into index.html) the app makes a php request. I want to return the values (array of string) for handling with my pascal written procedures. It all works but the "callback" to a pascal-procedure.

 

the script :

 

 

(function($) 
{ 
  sendcallback=function(patharray) 
  { 
    // call to pascal-procedure; 
  } 

  getresources = function() 
  { 
    $.ajax({ 
      url:"test.php", 
      type:"POST", 
      data: { task: "getresources" }, 
      success: function(pathdata) 
      { 
        var patharray = $.parseJSON(pathdata); 
        sendcallback(patharray); 
      }, 
      error: function(pathdata) {alert("Error")} 
    }); 
  }; 
})(jQuery); 

Link to post
Share on other sites

I don't know if I understand your problem, but can you put your code in an asm section?

 

Or do you want to use the compiled javascript in an other plain javascript file?

In that case you should manually "export" the functions you want to use outside the hidden SMS closure:

 
procedure Myfunction(); 
begin 
  showmessage('test'); 
end; 

initialization 
asm 
  window.Myfunction = @Myfunction; 
end;

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.

×
×
  • Create New...