Jump to content

Loading a URL from Jquery $.get()


BRMarcom

Recommended Posts

Is it possible to Load a URL from Jquery within the OnJobEnd callback?

try {

// I can see this
Print("Loading Jquery New");
Load('E:\\APPS\\TEST\\jQuery_min.js');

// But I don't see this and i'm not catching a
Print("Jquery Loaded");

var jqxhr = $.get( "https://api.marketpowerwebdev.com/fusionPro/disposition.cfm?fpid=123456", function() {
  Print( "success" );
})

} catch (error) {
  Print(error);
}
 

Link to comment
Share on other sites

You should be able to load most .js files with the Load() function.  However, the JavaScript engine that FusionPro uses is based on an older standard, so some newer JS files may have syntax that it doesn't recognize.

Let's back up a bit.  Can you explain what you're trying to accomplish?  There may be a simpler way to do it.

Link to comment
Share on other sites

We are finding that under heavy load, the checkstatus function on the server is coming back with a timeout but the job is completing. Rather than keep polling the FusionPro server API for the status, I'd like to have the OnJobEnd pull a URL that could them pass a few Parameters indicating that the job has finished. So the in the OnJobEnd there would be a call similar to this: $.get("https://api.someurl.com/disposition.cfm?fpSessionid=1112221111&status=Complete&pages=234")

 

 

 

Link to comment
Share on other sites

You should be able to just do this:

CreateResource("https://api.someurl.com/disposition.cfm?fpSessionid=1112221111&status=Complete&pages=234");

That will call the server and download the URL to a Resource object, though if you don't need that object you can ignore the return code.

Also, depending on the version of the FP Server API you're using, there may be a newer version which has better performance.  Please contact Support to explore options.

Link to comment
Share on other sites

21 hours ago, BRMarcom said:

That gives me an error regardless of the URL used. And the Description in the building blocks indicates "CreateResource(filename [,type] [,nonExistOK] [,encoding]) Creates a graphic or text resource from a file on disk."  Are you sure that can be used?

It can take a URL to a graphic or text file, such as this in a graphic rule:

 

return CreateResource("https://www.chicago.gov/content/dam/city/depts/dca/Public Art/CloudGate.jpg");

If what the URL points to isn't a file that can be downloaded, then you will get an error, but it should still call the server.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...