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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:31:48+00:00 2026-06-05T07:31:48+00:00

I have an POST AJAX command that returns the following: `email{admin@stackoverflow.com} cid{215}` What I

  • 0

I have an POST AJAX command that returns the following:

`email{admin@stackoverflow.com} cid{215}`

What I want do is replace the email{} and the cid{} with using only the values as vars

var email = 'admin@stackoverflow.com'
var customer_id = 215;

They would appear like that. Is there a cleaner way than:

var result = "email{admin@stackoverflow.com} cid{215}"; 

// change to        admin@stackoverflow.com cid{215}
var replace1 = result.replace("email{");
var replace1a = replace1.replace("}");

// change to        admin@stackoverflow.com 215
var replace2 = result.replace("cid{");
var replace2a = replace1.replace("}");

// now we have an email, with a space and a number
// admin@stackoverflow.com 215 make before space string
// this would be email

// now make only the int a string called cid
  • 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-05T07:31:50+00:00Added an answer on June 5, 2026 at 7:31 am

    First use a regular expression to extract desired data:

    var response = "email{admin@stackoverflow.com} cid{215}";
    var regex = /email\{(.*)\} cid\{(.*)\}/;
    var data = response.match(regex);
    

    Now you can easily obtain values you want:

    var email = data[1];
    var customer_id = +data[2];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have an ajax post that calls a service and returns an object
I have a AJAX post method that gets xml data from server. But when
i have the following javascript to post a form through ajax without refreshing the
I have a script that uses jQuery to POST data through AJAX to a
I understand that AJAX is asynchronous, and all that. But I have the following
I have an ajax POST request that is supposed to be submitting data to
I have the following code: name= a; value=b $.post(ajax.php, {name:value}).... However ajax.php will receive
I'm having problems with understanding how jQuery create headers for ajax post. I have
I have a jquery ajax request as follows; $.ajax({ type: 'POST', url: 'ajax.php', dataType:
I have grabbed some XML data using this piece of jQuery: $.ajax({ type: POST,

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.