Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 742629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:46:11+00:00 2026-05-14T08:46:11+00:00

I am trying to use jQuery to make a synchronous AJAX post to a

  • 0

I am trying to use jQuery to make a synchronous AJAX post to a server, and get a JSON response back.

I want to set a javascript variable msg upon successful return

This is what my code looks like:

$(document).ready(function(){
    $('#test').click(function(){
    alert('called!');
    jQuery.ajax({
      async: false,
      type: 'POST',
      url: 'http://www.example.com',
      data: 'id1=1&id2=2,&id3=3',
      dataType: 'json',
      success: function(data){ msg = data.msg; },
      error: function(xrq, status, et){alert('foobar\'d!');}
     });
});

[Edit]

I was accidentally mixing PHP and Javascript in my previous xode (now corrected). However, I now get this even more cryptic error message:

uncaught exception: [Exception… “Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]” nsresult: “0x80070057 (NS_ERROR_ILLEGAL_VALUE)” location: “JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js :: anonymous :: line 19″ data: no]

What the … ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:46:11+00:00Added an answer on May 14, 2026 at 8:46 am

    In your success callback, you are mixing Javascript and PHP code ; which is probably not quite what you want to do.

    You must be aware that :

    • PHP is executed on the server-side ; for .php files
    • Javascript is executed on the client-side (browser)

    The function hooked on the success callback will only be executed on the client-side, where there is no PHP execution ; and it will receive the data sent by the PHP script on the server-side (The one receiving the Ajax request).

    The data as received by the function hooked on success is a Javascript object.

    Which means that, here, you might want to use something like this :

    success: function(data){ msg = data.msg; },
    

    i.e. no PHP code here.


    Edit after the comment + edit of the OP

    You are getting a “NS_ERROR_ILLEGAL_VALUE nsIXMLHttpRequest.open” error ; which means, I suppose, that you are passing some kind of illegal URL to the Ajax request.

    Are you sure that the URL you’re passing to jQuery.ajax is a valid one ?

    For instance :

    • It should not be empty
    • It should point to an URL that’s on the same domain-name as your application
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to make a ajax call by making use of jquery UI
I'm trying to use jQuery to make an ajax request based on a selected
I'm trying to use Ajax together with jQuery to make a little window pop
Hi i'm trying to use jQuery/javascript to make my life easier. I'm trying to
In an ASP.NET MVC3 application, I'm trying to use jQuery to make an asynchronous
I am trying to use colorbox within an HTTPS-page.when I make the colorbox jquery
I am trying to use jquery autocomplete plugin, I want it to suggest ItemCodes
I'm trying to use jQuery.getJSON to get data from a domain I don't own
I am trying to make a jquery similar tabs. since its for single use
I am trying to use this jQuery script to make an image caption from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.