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

  • Home
  • SEARCH
  • 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 8474395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:36:55+00:00 2026-06-10T17:36:55+00:00

Possible Duplicate: How to replace only one parameter or fast with Jquery on Jquery

  • 0

Possible Duplicate:
How to replace only one parameter or fast with Jquery on Jquery String

The site have the query string is:

http://www.nonloso.html/?nome1=pollo&cognome1=chicken&nome2=a&cognome2=b&nome3=c&cognome3=d

This is the site where I have sent three form but now I would like to change the name of the second form that I sent. (nome=a&cognome=b)
Unless the data with the procedure that I read the site and subject to the variable.
I edit the field (variable) but as I’m going to rewrite on the site.
From name=a and surname=b that the site would become the new parameters.

http://www.nonloso.html/?nome1=pollo&cognome1=chicken&nome2=565655&cognome2=8765634&nome3=c&cognome3=d.

HoW???
How do I edit the site by changing only the values ​​of interest?

I repeat:
Before the my site is

http://www.nonloso.html/?nome1=pollo&cognome1=chicken&nome2=a&cognome2=b&nome3=c&cognome3=d

After with the script Javascrits or Jquery or ajax (is possible??) is

http://www.nonloso.html/?nome1=pollo&cognome1=chicken&nome2=565655&cognome2=8765634&nome3=c&cognome3=d

There is one solution or example?

  • 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-10T17:36:56+00:00Added an answer on June 10, 2026 at 5:36 pm

    You could use

    var change={
        nome2:565655,
        cognome2:8765634
    }
    if(window.location.search){
        var que = window.location.search.substring(1).split("&"),
            newArr=[];
        for(var i=0;i<que.length;i++){
            var qvar = que[i].split("=");
            if(change[qvar[0]]){
                qvar[1]=change[qvar[0]];
            }
            newArr.push(qvar.join('='));
        }
        window.location.search="?"+newArr.join('&');
    }
    

    Edit:

    Sorry, the code above works but it’s an eternal loop. Then, use

    var change={
        nome2:565655,
        cognome2:8765634
    }
    if(window.location.search){
        var que = window.location.search.substring(1).split("&"),
            newArr=[],
            changeURL=false;
        for(var i=0;i<que.length;i++){
            var qvar = que[i].split("=");
            if(change[qvar[0]]&&change[qvar[0]]!=qvar[1]){
                console.log('URL changed because of '+change[qvar[0]]+' != '+qvar[1]);
                qvar[1]=change[qvar[0]];
                changeURL=true;
            }
            newArr.push(qvar.join('='));
        }
        if(changeURL){
            window.location.search="?"+newArr.join('&');
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Replace only first match using preg_replace I have a string as follows:
Possible Duplicate: JavaScript replace all / with \ in a string? I have a
Possible Duplicate: How to replace string in SQLite? I have a table column data
Possible Duplicate: replace all occurrences in a string I have this string: 12-3-02 And
Possible Duplicate: Replace multiple whitespaces with single whitespace in JavaScript string I have used
Possible Duplicate: notepad++ Inverse Regex replace (all but string) Let's say I have the
Possible Duplicate: Replace words in a string, but ignore HTML Is it possible to
Possible Duplicate: Find and Replace more than 1 word? I want to use jQuery
Possible Duplicate: Insert string between two points with PHP How can I replace everything
Possible Duplicate: Regex exec only returning first match a1b2c3d.replace(/[0-9]/g,x) returns axbxdxd as expected. /[0-9]/g.exec(a1b2c3d)

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.