Reputation: 55
Below is my local url
Example : http://localhost/project/admin/resources/view_category/199
I need delete all text after resources and replace it with jquery
Example : http://localhost/project/admin/resources/please_help
).
Syntax of preg_math functions i don't know.
Upvotes: 0
Views: 84
Reputation: 32591
Use .split()
var str = "http://localhost/project/admin/resources/view_category/199"
str = str.split("resources")[0] + "resources/please_help"
console.log(str); //"http://localhost/project/admin/resources/please_help"
Upvotes: 1