I have an POST AJAX command that returns the following:
`email{[email protected]} cid{215}` What I want do is replace the email{} and the cid{} with using only the values as vars
var email = '[email protected]' var customer_id = 215; They would appear like that. Is there a cleaner way than:
var result = "email{[email protected]} cid{215}"; // change to [email protected] cid{215} var replace1 = result.replace("email{"); var replace1a = replace1.replace("}"); // change to [email protected] 215 var replace2 = result.replace("cid{"); var replace2a = replace1.replace("}"); // now we have an email, with a space and a number // [email protected] 215 make before space string // this would be email // now make only the int a string called cid