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 9205893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:04:03+00:00 2026-06-18T00:04:03+00:00

I am using this API to perform CRUD database operations in my meteor application.

  • 0

I am using this API to perform CRUD database operations in my meteor application. Till now, every operation is performed nicely.

Now consider a use case where some error occurs (eg. some validation error like invalid parameter) then I want to send the error object to the php script through jQuery ajax call.

So the question is: How to post the object to php from NodeJs script?

I have tried adding Meteor’s default jquery package by meteor add jquery. and then done something like this:

var $ = require('jquery');
....
....
 function test(data){
   console.log('test'+JSON.stringify(data));
     $.post({
        type: 'POST',
        url: 'http://vibsy.com/test/chest.php',
        data: data,
        success: function(data) {
          console.log(data);
        } 
     });
  }

But this shows the error:

ReferenceError: require is not defined
    at app\server\collectionapi.js:1:10

Any ideas?

  • 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-06-18T00:04:04+00:00Added an answer on June 18, 2026 at 12:04 am

    Jquery works well from the client side, im not too sure it will work on the server end. If you performed meteor add jquery you don’t have to use require. Meteor will automatically reference the correct js files ready to use. Remove the line below (client only) and it should be good to go

    var $ = require('jquery'); 
    

    If your script is running on the server, which it looks like it is. Its better to use Meteor.http. Run meteor add http and use something like:

    Meteor.http.call("POST", "http://vibsy.com/test/chest.php",{params: data}, function (error, result) {
        if (result.statusCode === 200) {
            console.log(result);
        }
     });
    

    Or more comfortably (sync):

    var result = Meteor.http.call("POST", "http://vibsy.com/test/chest.php",{params: data});
    if (result.statusCode === 200) {
        console.log(result.data); //JSON content
        console.log(result.content); //raw content
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using this code to post to my application page: $page_info = $facebook->api(/344722062246773?fields=access_token); $attachment2
I need to perform relatively frequent bulk updates/imports using the JIRA REST API. This
I want to create Contact on Google Apps. I am Using this API And
I'm using this terrible API for a client. It packages HTML/JS to an iPad
implementing publishActivity in PHP using the REST API using this code: $activity = array(
I'm using this PHP framework for use with Shopify's API Can anyone help me
So I'm trying to access this api https://www.clarityaccounting.com/api-docs/ using SUDS. Here is the code
I'm using LIFT to serve a RESTful API, and I want this API to
I'm consuming some data using the fogbugz XML API. This API always offers data
I'm developing a API that uses lambda expressions to specify properties. I'm using this

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.