0

I have written a perl script I can access from a URL: https://hostname/myweb/myScript.pl?id=1234&stg=13 I get the proper results using the URL

In javascript/jscript, I have tried loading the script ($('#element').load()) - I've tried full ajax calls within a function:

  $.ajax({
    url: '/myweb/myScript.pl',
    type: 'post',
    data: {
      'id' : '1234',
      'stg' : '13'
    }
  });

I am not having any success. If anyone can point me in the right direction, it would be greatly appreciated!

M

2
  • Crossposted to PerlMonks. Commented Oct 17, 2019 at 19:06
  • I am not having any success - It would be really helpful to know what this means. What unexpected behaviour are you seeing? Does nothing seem to happen? Is there an error message (perhaps in the web server error log)? Does your computer explode? Commented Oct 18, 2019 at 7:44

1 Answer 1

1

Looks like your perl script expect a get request not a post request try:

 $.ajax({
    url: '/myweb/myScript.pl?id=1234&stg=13',
    type: 'get'
  });

if you would like use data you can do it this way:

 $.ajax({
    url: '/myweb/myScript.pl',
    type: 'get',
    data: {
      'id' : '1234',
      'stg' : '13'
   }

  });

this should work too

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.