$ is not defined when using jquery code in express.js at parse.com

I think this problem comes from jquery not working, so please help me how to implement jquery in my main.js

(express.js controller) inparse.com

What i want to do

Load an image from parse cloud

and render this image toview template

(in .ejs file)

but i got $ is not defined

in parse.com log

I also added the line require('cloud/jquery.min.js');

my code

 /**
 * get user image
 */
app.get('/getUserImageAction',function(req,res){
var Documents = Parse.Object.extend("Documents"); // Documents class
var query = new Parse.Query(Documents); 
query.equalTo("imageOwner","234");
query.find({
success: function(imgObjects) {
var documentImage = imgObjects[0].get("imageFile");

$("documentImage")[0].src = documentImage.url();
Parse.Cloud.httpRequest({ url: documentImage.url()      }).then(function(response) {
// The file contents are in response.buffer.
   res.render('viewDocuments.ejs',{image:response.buffer});
  });
  },
 error: function(object, error) {
  res.render('hello.ejs',{message:+ error.code + " : " + error.message});

}
});
});

      

2) second - when commenting out this line , I get something in imgObjects

but got this error in the parsing log.

Result: Script ran out of memory

+1


source to share





All Articles