Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery invalid regular expression flag r?

I am using codeignitor with jquery.

My JS is as following:

 $(document).ready(function() {
 var p = {};
   $('#content').load(/mycontroller/myfunction,p,function(str){
    });
 });

It gave me an invalid regular expression flag r error on line 3. I am not sure it is a JS error, or the codeignitor mod_rewrite issue.

Can someone please shred some lights?

like image 238
Shadow_boi Avatar asked Jan 21 '23 05:01

Shadow_boi


2 Answers

You need quotes around the path:

"/mycontroller/myfunction"
like image 120
DGM Avatar answered Jan 28 '23 09:01

DGM


the .load() function takes a url in the form of a string.

var p = {};
  $('#content').load("/mycontroller/myfunction",p,function(str){
});
like image 31
Mark Coleman Avatar answered Jan 28 '23 07:01

Mark Coleman